Skip to content

Commit ef14fc7

Browse files
authored
Merge pull request #118 from vpuri3/method-ambig
fixed method ambig with +
2 parents 5905279 + 3c05385 commit ef14fc7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/basic.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,10 @@ end
311311
AddedOperator(L::AbstractSciMLOperator) = L
312312

313313
# constructors
314-
function Base.:+(ops::Union{AbstractSciMLOperator, AbstractMatrix}...)
315-
ops_ = ()
316-
for op in ops
317-
op = op isa AbstractMatrix ? MatrixOperator(op) : op
318-
ops_ = (ops_..., op)
319-
end
320-
AddedOperator(ops_...)
321-
end
314+
Base.:+(A::AbstractSciMLOperator, B::AbstractMatrix) = A + MatrixOperator(B)
315+
Base.:+(A::AbstractMatrix, B::AbstractSciMLOperator) = MatrixOperator(A) + B
316+
Base.:+(ops::AbstractSciMLOperator...) = AddedOperator(ops...)
317+
322318
Base.:+(A::AbstractSciMLOperator, B::AddedOperator) = AddedOperator(A, B.ops...)
323319
Base.:+(A::AddedOperator, B::AbstractSciMLOperator) = AddedOperator(A.ops..., B)
324320
Base.:+(A::AddedOperator, B::AddedOperator) = AddedOperator(A.ops..., B.ops...)

0 commit comments

Comments
 (0)