Skip to content

Commit

Permalink
Merge pull request #423 from JuliaArrays/ldlt2
Browse files Browse the repository at this point in the history
Better instance construction for ldlt
  • Loading branch information
ChrisRackauckas authored Nov 1, 2023
2 parents 646b8ab + 76673b6 commit 16f8d98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ArrayInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -546,13 +546,17 @@ Returns an instance of the LDLT factorization object with the correct type
cheaply.
"""
function ldlt_instance(A::Matrix{T}) where {T}
return ldlt(SymTridiagonal(similar(A, 0, 0)))
return ldlt_instance(SymTridiagonal(similar(A, 0, 0)))
end

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

function ldlt_instance(A::SymTridiagonal{T,V}) where {T,V}
return LinearAlgebra.LDLt{T,SymTridiagonal{T,V}}(A)
end

"""
ldlt_instance(a::Number) -> a
Expand Down

0 comments on commit 16f8d98

Please sign in to comment.