Skip to content

Commit 796eb67

Browse files
improve pivot
1 parent 727f4e7 commit 796eb67

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Project.toml

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

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

src/ArrayInterface.jl

+11-4
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.NoPivot()) 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::Union{SparseMatrixCSC,Symmetric{<:Number,<: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

0 commit comments

Comments
 (0)