Skip to content

Commit

Permalink
Merge pull request #289 from SciML/ChrisRackauckas-patch-1
Browse files Browse the repository at this point in the history
Add specialized `ldiv!` handling
  • Loading branch information
ChrisRackauckas authored Dec 22, 2024
2 parents 5f91b28 + 8e0fe7f commit 2f217a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/linear_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ function LinearAlgebra.axpby!(α::Number, x::ComponentArray, β::Number, y::Comp
axpby!(α, getdata(x), β, getdata(y))
return ComponentArray(y, getaxes(y))
end

function LinearAlgebra.ldiv!(B::AbstractVecOrMat, D::Diagonal{Float64, <:ComponentArray}, A::AbstractVecOrMat)
ldiv!(B, Diagonal(Vector(D.diag)), A)
end
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ end
@test ldiv!(tempmat, lu(cmat + I), cmat) isa ComponentMatrix
@test ldiv!(getdata(tempmat), lu(cmat + I), cmat) isa AbstractMatrix

c = (a=2, b=[1, 2]);
x = ComponentArray(a=5, b=[(a=20., b=3.0), (a=33., b=2.0), (a=44., b=3.0)], c=c)
@test ldiv!(rand(10),Diagonal(x), x) isa Vector

vca2 = vcat(ca2', ca2')
hca2 = hcat(ca2, ca2)
temp = ComponentVector(q = 100, r = rand(3, 3, 3))
Expand Down

0 comments on commit 2f217a5

Please sign in to comment.