@@ -4,7 +4,7 @@ $SIGNATURES
44
55Represents a linear operator given by an `AbstractMatrix` that may be
66applied to an `AbstractVecOrMat`. Its state is updated by the user-provided
7- `update_func` during operator evaluation (`L([v,] , u, p, t)`), or by calls
7+ `update_func` during operator evaluation (`L([w,], v , u, p, t)`), or by calls
88to `update_coefficients[!](L, u, p, t)`. Both recursively call the
99`update_function`, `update_func` which is assumed to have the signature
1010
@@ -30,6 +30,7 @@ adjoints, transposes.
3030
3131Out-of-place update and usage
3232```
33+ v = rand(4)
3334u = rand(4)
3435p = rand(4, 4)
3536t = rand()
@@ -38,38 +39,39 @@ mat_update = (A, u, p, t; scale = 0.0) -> t * p
3839M = MatrixOperator(0.0; update_func = mat_update, accepted_kwargs = (:scale,))
3940
4041L = M * M + 3I
41- L = cache_operator(L, u )
42+ L = cache_operator(L, v )
4243
4344# update and evaluate
44- v = L(u , u, p, t; scale = 1.0)
45+ w = L(v , u, p, t; scale = 1.0)
4546
4647# In-place evaluation
47- w = similar(u )
48- L(w, u , u, p, t; scale = 1.0)
48+ w = similar(v )
49+ L(w, v , u, p, t; scale = 1.0)
4950
5051# In-place with scaling
5152β = 0.5
52- L(w, u , u, p, t, 2.0, β; scale = 1.0) # w = 2.0*(L*u ) + 0.5*w
53+ L(w, v , u, p, t, 2.0, β; scale = 1.0) # w = 2.0*(L*v ) + 0.5*w
5354```
5455
5556In-place update and usage
5657```
58+ w = zeros(4)
5759v = zeros(4)
5860u = rand(4)
5961p = rand(4) # Must be non-nothing
6062t = rand()
6163
62- mat_update! = (A, u, p, t; scale = 0.0) -> (A .= t * p * p ' * scale)
64+ mat_update! = (A, u, p, t; scale = 0.0) -> (A .= t * p * u ' * scale)
6365M = MatrixOperator(zeros(4, 4); update_func! = mat_update!, accepted_kwargs = (:scale,))
6466L = M * M + 3I
65- L = cache_operator(L, u )
67+ L = cache_operator(L, v )
6668
6769# update L in-place and evaluate
6870update_coefficients!(L, u, p, t; scale = 1.0)
69- mul!(v , L, u )
71+ mul!(w , L, v )
7072
7173# Or use the new interface that separates update and application
72- L(v, u , u, p, t; scale = 1.0)
74+ L(w, v , u, p, t; scale = 1.0)
7375```
7476"""
7577struct MatrixOperator{T, AT <: AbstractMatrix{T} , F, F!} <: AbstractSciMLOperator{T}
@@ -250,16 +252,16 @@ $SIGNATURES
250252Represents an elementwise scaling (diagonal-scaling) operation that may
251253be applied to an `AbstractVecOrMat`. When `diag` is an `AbstractVector`
252254of length N, `L = DiagonalOperator(diag, ...)` can be applied to
253- `AbstractArray`s with `size(u, 1) == N`. Each column of the `u ` will be
254- scaled by `diag`, as in `LinearAlgebra.Diagonal(diag) * u `.
255+ `AbstractArray`s with `size(u, 1) == N`. Each column of the `v ` will be
256+ scaled by `diag`, as in `LinearAlgebra.Diagonal(diag) * v `.
255257
256258When `diag` is a multidimensional array, `L = DiagonalOperator(diag, ...)` forms
257259an operator of size `(N, N)` where `N = size(diag, 1)` is the leading length of `diag`.
258- `L` then is the elementwise-scaling operation on arrays of `length(u ) = length(diag)`
260+ `L` then is the elementwise-scaling operation on arrays of `length(v ) = length(diag)`
259261with leading length `size(u, 1) = N`.
260262
261263Its state is updated by the user-provided `update_func` during operator
262- evaluation (`L([v,] , u, p, t)`), or by calls to
264+ evaluation (`L([w,], v , u, p, t)`), or by calls to
263265`update_coefficients[!](L, u, p, t)`. Both recursively call the
264266`update_function`, `update_func` which is assumed to have the signature
265267
@@ -446,10 +448,10 @@ end
446448"""
447449$SIGNATURES
448450
449- Represents a generalized affine operation (`v = A * u + B * b`) that may
451+ Represents a generalized affine operation (`w = A * v + B * b`) that may
450452be applied to an `AbstractVecOrMat`. The user-provided update functions,
451453`update_func[!]` update the `AbstractVecOrMat` `b`, and are called
452- during operator evaluation (`L([v,] , u, p, t)`), or by calls
454+ during operator evaluation (`L([w,], v , u, p, t)`), or by calls
453455to `update_coefficients[!](L, u, p, t)`. The update functions are
454456assumed to have the syntax
455457
459461 update_func!(b::AbstractVecOrMat, u ,p , t; <accepted kwargs>) -> [modifies b]
460462
461463and `B`, `b` are expected to have an appropriate size so that
462- `A * u + B * b` makes sense. Specifically, `size(A, 1) == size(B, 1)`, and
463- `size(u , 2) == size(b, 2)`.
464+ `A * v + B * b` makes sense. Specifically, `size(A, 1) == size(B, 1)`, and
465+ `size(v , 2) == size(b, 2)`.
464466
465467The set of keyword-arguments accepted by `update_func[!]` must be provided
466468to `AffineOperator` via the kwarg `accepted_kwargs` as a tuple of `Symbol`s.
@@ -470,19 +472,20 @@ are not provided.
470472# Example
471473
472474```
475+ v = rand(4)
473476u = rand(4)
474477p = rand(4)
475478t = rand()
476479
477480A = MatrixOperator(rand(4, 4))
478481B = MatrixOperator(rand(4, 4))
479482
480- vec_update_func = (b, u, p, t) -> p * t
483+ vec_update_func = (b, u, p, t) -> p .* u * t
481484L = AffineOperator(A, B, zero(4); update_func = vec_update_func)
482- L = cache_operator(M, u )
485+ L = cache_operator(M, v )
483486
484487# update L and evaluate
485- v = L(u, p, t) # == A * u + B * (p * t)
488+ w = L(v, u, p, t) # == A * v + B * (p .* u * t)
486489```
487490
488491"""
532535"""
533536$SIGNATURES
534537
535- Represents the affine operation `v = I * u + I * b`. The update functions,
538+ Represents the affine operation `w = I * v + I * b`. The update functions,
536539`update_func[!]` update the state of `AbstractVecOrMat ` `b`. See
537540documentation of `AffineOperator` for more details.
538541"""
552555"""
553556$SIGNATURES
554557
555- Represents the affine operation `v = I * u + B * b`. The update functions,
558+ Represents the affine operation `w = I * v + B * b`. The update functions,
556559`update_func[!]` update the state of `AbstractVecOrMat ` `b`. See
557560documentation of `AffineOperator` for more details.
558561"""
0 commit comments