Skip to content

Commit 08f8d01

Browse files
authored
Merge branch 'master' into index-labels
2 parents f08a644 + 796eb67 commit 08f8d01

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
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.3"
3+
version = "7.4.8"
44

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

src/ArrayInterface.jl

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,23 @@ Returns the number.
467467
"""
468468
bunchkaufman_instance(a::Any) = bunchkaufman(a, check = false)
469469

470+
@static if VERSION < v"1.7beta"
471+
const DEFAULT_CHOLESKY_PIVOT = Val(false)
472+
else
473+
const DEFAULT_CHOLESKY_PIVOT = LinearAlgebra.NoPivot()
474+
end
475+
470476
"""
471477
cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorization_instance
472478
473479
Returns an instance of the Cholesky factorization object with the correct type
474480
cheaply.
475481
"""
476-
function cholesky_instance(A::Matrix{T}, pivot = LinearAlgebra.RowMaximum()) where {T}
482+
function cholesky_instance(A::Matrix{T}, pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
477483
return cholesky(similar(A, 0, 0), pivot, check = false)
478484
end
479-
function cholesky_instance(A::SparseMatrixCSC, pivot = LinearAlgebra.RowMaximum())
485+
486+
function cholesky_instance(A::Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}}, pivot = DEFAULT_CHOLESKY_PIVOT)
480487
cholesky(sparse(similar(A, 1, 1)), check = false)
481488
end
482489

@@ -485,15 +492,15 @@ cholesky_instance(a::Number, pivot = LinearAlgebra.RowMaximum()) -> a
485492
486493
Returns the number.
487494
"""
488-
cholesky_instance(a::Number, pivot = LinearAlgebra.RowMaximum()) = a
495+
cholesky_instance(a::Number, pivot = DEFAULT_CHOLESKY_PIVOT) = a
489496

490497
"""
491498
cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) -> cholesky(a, check=false)
492499
493500
Slow fallback which gets the instance via factorization. Should get
494501
specialized for new matrix types.
495502
"""
496-
cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) = cholesky(a, pivot, check = false)
503+
cholesky_instance(a::Any, pivot = DEFAULT_CHOLESKY_PIVOT) = cholesky(a, pivot, check = false)
497504

498505
"""
499506
ldlt_instance(A) -> ldlt_factorization_instance
@@ -502,10 +509,10 @@ Returns an instance of the LDLT factorization object with the correct type
502509
cheaply.
503510
"""
504511
function ldlt_instance(A::Matrix{T}) where {T}
505-
return ldlt(SymTridiagonal(similar(A, 0, 0)), check = false)
512+
return ldlt(SymTridiagonal(similar(A, 0, 0)))
506513
end
507514
function ldlt_instance(A::SparseMatrixCSC)
508-
ldlt(sparse(similar(A, 1, 1)), check = false)
515+
ldlt(sparse(similar(A, 1, 1)), check=false)
509516
end
510517

511518
"""
@@ -573,7 +580,7 @@ Returns an instance of the QR factorization object with the correct type
573580
cheaply.
574581
"""
575582
function qr_instance(A::Matrix{T}) where {T}
576-
LinearAlgebra.QRCompactWYQ(zeros(T,0,0),zeros(T,0,0))
583+
LinearAlgebra.QRCompactWY(zeros(T,0,0),zeros(T,0,0))
577584
end
578585

579586
function qr_instance(A::Matrix{BigFloat})

test/core.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,21 @@ end
282282
@test ArrayInterface.qr_instance(A) isa typeof(qr(A))
283283

284284
if !(eltype(A) <: BigFloat)
285-
@test ArrayInterface.bunchkaufman_instance(A) isa typeof(bunchkaufman(A' * A))
286-
@test ArrayInterface.cholesky_instance(A) isa typeof(cholesky(A' * A))
287-
@test ArrayInterface.ldlt_instance(A) isa typeof(ldlt(SymTridiagonal(A' * A)))
285+
@test ArrayInterface.bunchkaufman_instance(A' * A) isa typeof(bunchkaufman(A' * A))
286+
@test ArrayInterface.cholesky_instance(A' * A) isa typeof(cholesky(A' * A))
287+
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
288288
@test ArrayInterface.svd_instance(A) isa typeof(svd(A))
289289
end
290290
end
291+
292+
for A in [sparse([1.0 2.0; 3.0 4.0])]
293+
@test ArrayInterface.lu_instance(A) isa typeof(lu(A))
294+
@test ArrayInterface.qr_instance(A) isa typeof(qr(A))
295+
if VERSION >= v"1.9-"
296+
@test ArrayInterface.cholesky_instance(A' * A) isa typeof(cholesky(A' * A))
297+
end
298+
@test ArrayInterface.ldlt_instance(SymTridiagonal(A' * A)) isa typeof(ldlt(SymTridiagonal(A' * A)))
299+
end
291300
end
292301

293302
@testset "index_labels" begin

0 commit comments

Comments
 (0)