DiffEqOperators
Constructors
Wrapping an Array: DiffEqArrayOperator
DiffEqArrayOperator
is for defining an operator directly from an array. The operator is of the form:
for some scalar α
and time plus possibly state dependent A
. The constructor is:
DiffEqArrayOperator(A::AbstractMatrix{T}, update_func = DEFAULT_UPDATE_FUNC)
A
is the operator array. update_func(A,u,p,t)
is the function called by update_coefficients!(A,u,p,t)
. If left as its default, then update_func
is trivial, which signifies A
is a constant.
AffineDiffEqOperator
For As = (A1,A2,...,An)
and Bs = (B1,B2,...,Bm)
where each of the Ai
and Bi
are AbstractDiffEqOperator
s, the following constructor:
AffineDiffEqOperator{T}(As, Bs, u_cache = nothing)
builds an operator L = (A1 + A2 + ... An)*u + B1 + B2 + ... + Bm
. u_cache
is for designating a type of internal cache for non-allocating evaluation of L(du,u,p,t)
. If not given, the function L(du,u,p,t)
is not available. Note that in solves which exploit this structure, this function call is not necessary. It’s only used as the fallback in ODE solvers, which were not developed for this structure.
Formal Properties of DiffEqOperators
These are the formal properties that an AbstractDiffEqOperator
should obey for it to work in the solvers.
AbstractDiffEqOperator Interface Description
-
Function call and multiplication:
L(du,u,p,t)
for inplace anddu = L(u,p,t)
for out-of-place, meaningL*u
andmul!
. -
If the operator is not a constant, update it with
(u,p,t)
. A mutating form, i.e.,update_coefficients!(A,u,p,t)
that changes the internal coefficients, and an out-of-place formB = update_coefficients(A,u,p,t)
. -
isconstant(A)
trait for whether the operator is constant or not.
AbstractDiffEqLinearOperator Interface Description
-
AbstractDiffEqLinearOperator <: AbstractDiffEqOperator
-
Can absorb under multiplication by a scalar. In all algorithms, things like
dt*L
show up all the time, so the linear operator must be able to absorb such constants. -
isconstant(A)
trait for whether the operator is constant or not. -
Optional:
diagonal
,symmetric
, etc. traits from LinearMaps.jl. -
Optional:
exp(A)
. Required for simple exponential integration. -
Optional:
expv(A,u,t) = exp(t*A)*u
andexpv!(v,A::DiffEqOperator,u,t)
Required for sparse-saving exponential integration. -
Optional: factorizations.
ldiv!
,factorize
et al. This is only required for algorithms which use the factorization of the operator (Crank-Nicolson), and only for when the default linear solve is used.