You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/func.jl
+21-23Lines changed: 21 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
#
2
2
"""
3
-
Matrix free operators (given by a function)
3
+
Matrix free operator given by a function
4
4
5
5
$(FIELDS)
6
6
"""
@@ -115,45 +115,36 @@ is assumed to be of the same type and share as the input.
115
115
116
116
# Keyword Arguments
117
117
118
-
Keyword arguments are used to pass in the adjoint operator, `op_adjoint`,
119
-
the inverse operator, `op_inverse`, and the adjoint-inverse operator
120
-
`adjoint_inverse`. All are assumed to have the same calling signature and
118
+
Keyword arguments are used to pass in the adjoint evaluation function,
119
+
`op_adjoint`, the inverse function, `op_inverse`, and the adjoint-inverse
120
+
function `adjoint_inverse`. All are assumed to have the same calling signature and
121
121
below traits.
122
122
123
123
## Traits
124
124
Keyword arguments are used to set operator traits, which are assumed to be
125
125
uniform across `op`, `op_adjoint`, `op_inverse`, `op_adjoint_inverse`.
126
126
127
+
* `p` - Prototype of parameter struct passed to the operator during evaluation, i.e. `L(u, p, t)`. `p` is set to `nothing` if no value is provided.
128
+
* `t` - Protype of scalar time variable passed to the operator during evaluation. `t` is set to `zero(T)` if no value is provided.
129
+
* `accepted_kwargs` - `Tuple` of `Symbol`s corresponding to the keyword arguments accepted by `op*`, and `update_coefficients[!]`. For example, if `op` accepts kwarg `scale`, as in `op(u, p, t; scale)`, then `accepted_kwargs = (:scale,)`.
130
+
131
+
* `T` - `eltype` of the operator. If no value is provided, the constructor inferrs the value from types of `input`, and `output`
127
132
* `isinplace` - `true` if the operator can be used is a mutating way with in-place allocations. This trait is inferred if no value is provided.
128
133
* `outofplace` - `true` if the operator can be used is a non-mutating way with in-place allocations. This trait is inferred if no value is provided.
129
-
* `isconstant` - `true` if the operator is constant, and doesn't need to be updated via `update_coefficients[!]` during operator evaluation.
130
134
* `has_mul5` - `true` if the operator provides a five-argument `mul!` via the signature `op(v, u, p, t, α, β; <accepted_kwargs>)`. This trait is inferred if no value is provided.
131
-
* `cache` - Pregenerated cache arrays for in-place evaluations. Expected to be of type and shape `(similar(input), similar(output),)`. The constructor generates cache if no values are provided. Cache generation by the constructor can be disabled by setting the kwarg `ifcache = false`.
132
-
* `T` - `eltype` of the operator. If no value is provided, the constructor inferrs the value from types of `input`, and `output`
133
-
* `p` - Prototype of parameter struct passed to the operator during evaluation, i.e. `L(u, p, t)`. `p` is set to `nothing` if no value is provided.
134
-
* `t` - Protype of scalar time variable passed to the operator during evaluation. `t` is set to `zero(T)` if no value is provided.
135
-
* `ifcache` - Allocate cache arrays in constructor. Defaults to `true`. Cache can be generated afterwards by calling `cache_operator(L, input, output)`
135
+
* `isconstant` - `true` if the operator is constant, and doesn't need to be updated via `update_coefficients[!]` during operator evaluation.
136
136
* `islinear` - `true` if the operator is linear. Defaults to `false`.
137
+
* `ifcache` - Allocate cache arrays in constructor. Defaults to `true`. Cache can be generated afterwards by calling `cache_operator(L, input, output)`
138
+
* `cache` - Pregenerated cache arrays for in-place evaluations. Expected to be of type and shape `(similar(input), similar(output),)`. The constructor generates cache if no values are provided. Cache generation by the constructor can be disabled by setting the kwarg `ifcache = false`.
137
139
* `opnorm` - The norm of `op`. Can be a `Number`, or function `opnorm(p::Integer)`. Defaults to `nothing`.
138
140
* `issymmetric` - `true` if the operator is linear and symmetric. Defaults to `false`.
139
141
* `ishermitian` - `true` if the operator is linear and hermitian. Defaults to `false`.
140
142
* `isposdef` - `true` if the operator is linear and positive-definite. Defaults to `false`.
141
-
142
-
Cache arrays can optionally be passed in via the
143
-
kwarg `cache`, and
144
-
disabled by passing the kwarg `cach`
145
143
"""
146
144
functionFunctionOperator(op,
147
145
input::AbstractVecOrMat,
148
146
output::AbstractVecOrMat= input;
149
147
150
-
isinplace::Union{Nothing,Bool}=nothing,
151
-
outofplace::Union{Nothing,Bool}=nothing,
152
-
isconstant::Bool=false,
153
-
has_mul5::Union{Nothing,Bool}=nothing,
154
-
cache::Union{Nothing, NTuple{2}}=nothing,
155
-
T::Union{Type{<:Number},Nothing}=nothing,
156
-
157
148
op_adjoint=nothing,
158
149
op_inverse=nothing,
159
150
op_adjoint_inverse=nothing,
@@ -162,11 +153,18 @@ function FunctionOperator(op,
0 commit comments