Skip to content

Commit 727f4e7

Browse files
Merge pull request #417 from JuliaArrays/chol
Fix cholesky_instance for symmetric sparse
2 parents 93d728f + 72f4524 commit 727f4e7

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ArrayInterface"
22
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
3-
version = "7.4.6"
3+
version = "7.4.7"
44

55
[deps]
66
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/ArrayInterface.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,10 @@ cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorizati
473473
Returns an instance of the Cholesky factorization object with the correct type
474474
cheaply.
475475
"""
476-
function cholesky_instance(A::Matrix{T}, pivot = LinearAlgebra.RowMaximum()) where {T}
476+
function cholesky_instance(A::Matrix{T}, pivot = LinearAlgebra.NoPivot()) where {T}
477477
return cholesky(similar(A, 0, 0), pivot, check = false)
478478
end
479-
function cholesky_instance(A::SparseMatrixCSC, pivot = LinearAlgebra.RowMaximum())
479+
function cholesky_instance(A::Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}}, pivot = LinearAlgebra.RowMaximum())
480480
cholesky(sparse(similar(A, 1, 1)), check = false)
481481
end
482482

test/core.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,19 @@ end
267267
@test ArrayInterface.qr_instance(A) isa typeof(qr(A))
268268

269269
if !(eltype(A) <: BigFloat)
270-
@test ArrayInterface.bunchkaufman_instance(A) isa typeof(bunchkaufman(A' * A))
271-
@test ArrayInterface.cholesky_instance(A) isa typeof(cholesky(A' * A))
272-
@test ArrayInterface.ldlt_instance(A) isa typeof(ldlt(SymTridiagonal(A' * A)))
270+
@test ArrayInterface.bunchkaufman_instance(A' * A) isa typeof(bunchkaufman(A' * A))
271+
@test ArrayInterface.cholesky_instance(A' * A) isa typeof(cholesky(A' * A))
272+
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
273273
@test ArrayInterface.svd_instance(A) isa typeof(svd(A))
274274
end
275275
end
276+
277+
for A in [sparse([1.0 2.0; 3.0 4.0])]
278+
@test ArrayInterface.lu_instance(A) isa typeof(lu(A))
279+
@test ArrayInterface.qr_instance(A) isa typeof(qr(A))
280+
if VERSION >= v"1.9-"
281+
@test ArrayInterface.cholesky_instance(A' * A) isa typeof(cholesky(A' * A))
282+
end
283+
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
284+
end
276285
end

0 commit comments

Comments
 (0)