5656
5757# ## Operator Implementation
5858
59- mutable struct JacVecOperator{T,F,T1,T2,uType,P,tType} <: DiffEqBase.AbstractDiffEqLinearOperator{T}
59+ mutable struct JacVecOperator{T,F,T1,T2,uType,P,tType,O } <: DiffEqBase.AbstractDiffEqLinearOperator{T}
6060 f:: F
6161 cache1:: T1
6262 cache2:: T2
6363 u:: uType
6464 p:: P
6565 t:: tType
6666 autodiff:: Bool
67+ ishermitian:: Bool
68+ opnorm:: O
6769
68- function JacVecOperator {T} (f,p= nothing ,t:: Union{Nothing,Number} = nothing ;autodiff= true ) where T
70+ function JacVecOperator {T} (f,p= nothing ,t:: Union{Nothing,Number} = nothing ;autodiff= true ,ishermitian = false ,opnorm = true ) where T
6971 p=== nothing ? P = Any : P = typeof (p)
7072 t=== nothing ? tType = Any : tType = typeof (t)
71- new {T,typeof(f),Nothing,Nothing,Any,P,tType} (f,nothing ,nothing ,nothing ,nothing ,nothing ,autodiff)
73+ new {T,typeof(f),Nothing,Nothing,Any,P,tType,typeof(opnorm) } (f,nothing ,nothing ,nothing ,nothing ,nothing ,autodiff,ishermitian )
7274 end
73- function JacVecOperator {T} (f,u:: AbstractArray ,p= nothing ,t:: Union{Nothing,Number} = nothing ;autodiff= true ) where T
75+ function JacVecOperator {T} (f,u:: AbstractArray ,p= nothing ,t:: Union{Nothing,Number} = nothing ;autodiff= true ,ishermitian = false ,opnorm = true ) where T
7476 if autodiff
7577 cache1 = ForwardDiff. Dual {JacVecTag} .(u, u)
7678 cache2 = ForwardDiff. Dual {JacVecTag} .(u, u)
@@ -80,14 +82,16 @@ mutable struct JacVecOperator{T,F,T1,T2,uType,P,tType} <: DiffEqBase.AbstractDif
8082 end
8183 p=== nothing ? P = Any : P = typeof (p)
8284 t=== nothing ? tType = Any : tType = typeof (t)
83- new {T,typeof(f),typeof(cache1),typeof(cache2),typeof(u),P,tType} (f,cache1,cache2,u,p,t,autodiff)
85+ new {T,typeof(f),typeof(cache1),typeof(cache2),typeof(u),P,tType,typeof(opnorm) } (f,cache1,cache2,u,p,t,autodiff,ishermitian,opnorm )
8486 end
8587 function JacVecOperator (f,u,args... ;kwargs... )
8688 JacVecOperator {eltype(u)} (f,u,args... ;kwargs... )
8789 end
88-
8990end
9091
92+ LinearAlgebra. opnorm (L:: JacVecOperator , p:: Real = 2 ) = L. opnorm
93+ LinearAlgebra. ishermitian (L:: JacVecOperator ) = L. ishermitian
94+
9195Base. size (L:: JacVecOperator ) = (length (L. cache1),length (L. cache1))
9296Base. size (L:: JacVecOperator ,i:: Int ) = length (L. cache1)
9397function update_coefficients! (L:: JacVecOperator ,u,p,t)
0 commit comments