Skip to content

Commit 76673b6

Browse files
Better instance construction for ldlt
Cannot be singular checked in some versions, so this is a nicer way to handle it. Fixes SciML/OrdinaryDiffEq.jl#2041
1 parent 646b8ab commit 76673b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ArrayInterface.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,17 @@ Returns an instance of the LDLT factorization object with the correct type
546546
cheaply.
547547
"""
548548
function ldlt_instance(A::Matrix{T}) where {T}
549-
return ldlt(SymTridiagonal(similar(A, 0, 0)))
549+
return ldlt_instance(SymTridiagonal(similar(A, 0, 0)))
550550
end
551551

552552
function ldlt_instance(A::SparseMatrixCSC)
553553
ldlt(sparse(similar(A, 1, 1)), check=false)
554554
end
555555

556+
function ldlt_instance(A::SymTridiagonal{T,V}) where {T,V}
557+
return LinearAlgebra.LDLt{T,SymTridiagonal{T,V}}(A)
558+
end
559+
556560
"""
557561
ldlt_instance(a::Number) -> a
558562

0 commit comments

Comments
 (0)