Skip to content

Commit 21043fb

Browse files
committed
* and \: support const SparseMatrixCSC
1 parent ebcdf17 commit 21043fb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250"
1313
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1414
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1515
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
16+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1617

1718
[weakdeps]
1819
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

src/ForwardDiff.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ using DiffResults: DiffResult, MutableDiffResult
55
using Preferences
66
using Random
77
using LinearAlgebra
8+
using SparseArrays
89
using Base: require_one_based_indexing
10+
911
import Printf
1012
import NaNMath
1113
import SpecialFunctions

src/dual.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,17 +824,20 @@ end
824824
# implement ldiv!() of dual vector by a matrix
825825
LinearAlgebra.ldiv!(y::StridedVector{T},
826826
m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
827-
UpperTriangular{<:LinearAlgebra.BlasFloat}},
827+
UpperTriangular{<:LinearAlgebra.BlasFloat},
828+
SparseMatrixCSC{<:LinearAlgebra.BlasFloat}},
828829
x::StridedVector{T}) where T <: Dual =
829830
(ldiv!(reinterpret(reshape, valtype(T), y)', m, reinterpret(reshape, valtype(T), x)'); y)
830831

831832
Base.:\(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
832-
UpperTriangular{<:LinearAlgebra.BlasFloat}},
833+
UpperTriangular{<:LinearAlgebra.BlasFloat},
834+
SparseMatrixCSC{<:LinearAlgebra.BlasFloat}},
833835
x::StridedVector{<:Dual}) = ldiv!(similar(x), m, x)
834836

835837
for MT in (StridedMatrix{<:LinearAlgebra.BlasFloat},
836838
LowerTriangular{<:LinearAlgebra.BlasFloat},
837839
UpperTriangular{<:LinearAlgebra.BlasFloat},
840+
SparseMatrixCSC{<:LinearAlgebra.BlasFloat},
838841
)
839842
@eval begin
840843

0 commit comments

Comments
 (0)