Skip to content

Commit 3be48a8

Browse files
Merge pull request #149 from vpuri3/issq
check first two dimensions for `issquare`
2 parents 9a92f02 + a027058 commit 3be48a8

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/func.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function FunctionOperator(op,
171171
)
172172
end
173173

174-
function update_coefficients(L, u, p, t)
174+
function update_coefficients(L::FunctionOperator, u, p, t)
175175
op = update_coefficients(L.op, u, p, t)
176176
op_adjoint = update_coefficients(L.op_adjoint, u, p, t)
177177
op_inverse = update_coefficients(L.op_inverse, u, p, t)

src/interface.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,22 @@ has_adjoint(::Union{
186186
}
187187
) = true
188188

189-
issquare(L) = isequal(size(L)...)
189+
issquare(L) = ndims(L) >= 2 && size(L, 1) == size(L, 2)
190+
issquare(::AbstractVector) = false
190191
issquare(::Union{
191192
# LinearAlgebra
192193
UniformScaling,
193194

195+
# SciMLOperators
196+
AbstractSciMLScalarOperator,
197+
194198
# Base
195199
Number,
196200
}
197201
) = true
198202
issquare(A...) = @. (&)(issquare(A)...)
199203

204+
Base.ndims(L::AbstractSciMLOperator) = length(size(L))
200205
Base.isreal(L::AbstractSciMLOperator{T}) where{T} = T <: Real
201206
Base.Matrix(L::AbstractSciMLOperator) = Matrix(convert(AbstractMatrix, L))
202207

src/scalar.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Base.adjoint(α::AbstractSciMLScalarOperator) = conj(α)
2626
Base.transpose::AbstractSciMLScalarOperator) = α
2727

2828
has_mul!(::AbstractSciMLScalarOperator) = true
29-
issquare(::AbstractSciMLScalarOperator) = true
3029
islinear(::AbstractSciMLScalarOperator) = true
3130
has_adjoint(::AbstractSciMLScalarOperator) = true
3231

0 commit comments

Comments
 (0)