@@ -178,20 +178,9 @@ struct AffineOperator{T,AType,BType,bType,cType,F} <: AbstractSciMLOperator{T}
178178 cache:: cType
179179 update_func:: F
180180
181- function AffineOperator (A:: Union{AbstractMatrix,AbstractSciMLOperator} ,
182- B:: Union{AbstractMatrix,AbstractSciMLOperator} ,
183- b:: AbstractVecOrMat ;
184- update_func= DEFAULT_UPDATE_FUNC,
185- )
186- A = A isa AbstractMatrix ? MatrixOperator (A) : A
187- B = B isa AbstractMatrix ? MatrixOperator (A) : B
188-
189- @assert size (A, 1 ) == size (B, 1 )
190- @assert size (B, 2 ) == size (b, 1 )
181+ function AffineOperator (A, B, b, cache, update_func)
191182 T = promote_type (eltype .((A,B,b))... )
192183
193- cache = B * b
194-
195184 new{T,
196185 typeof (A),
197186 typeof (B),
@@ -204,6 +193,20 @@ struct AffineOperator{T,AType,BType,bType,cType,F} <: AbstractSciMLOperator{T}
204193 end
205194end
206195
196+ function AffineOperator (A:: Union{AbstractMatrix,AbstractSciMLOperator} ,
197+ B:: Union{AbstractMatrix,AbstractSciMLOperator} ,
198+ b:: AbstractVecOrMat ;
199+ update_func= DEFAULT_UPDATE_FUNC,
200+ )
201+ @assert size (A, 1 ) == size (B, 1 ) " size mismatch: A, B don't output vectors of same size"
202+
203+ A = A isa AbstractMatrix ? MatrixOperator (A) : A
204+ B = B isa AbstractMatrix ? MatrixOperator (B) : B
205+ cache = B * b
206+
207+ AffineOperator (A, B, b, cache, update_func)
208+ end
209+
207210function AddVector (b:: AbstractVecOrMat ; update_func= DEFAULT_UPDATE_FUNC)
208211 N = size (b, 1 )
209212 Z = NullOperator {N} ()
0 commit comments