Skip to content

Commit

Permalink
Merge pull request #336 from SciML/qrpivot
Browse files Browse the repository at this point in the history
Fix QR initializations with pivoting
  • Loading branch information
ChrisRackauckas authored Jun 19, 2023
2 parents 19cfb42 + acdc581 commit 8259a1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
ArrayInterface = "7.4.7"
ArrayInterface = "7.4.11"
DocStringExtensions = "0.8, 0.9"
EnumX = "1"
FastLapackInterface = "1"
Expand Down
19 changes: 14 additions & 5 deletions src/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,24 @@ end
function init_cacheval(alg::QRFactorization, A, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
ArrayInterface.qr_instance(convert(AbstractMatrix, A))
ArrayInterface.qr_instance(convert(AbstractMatrix, A), alg.pivot)
end

const PREALLOCATED_QR = ArrayInterface.qr_instance(rand(1, 1))

function init_cacheval(alg::QRFactorization, A::Matrix{Float64}, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
PREALLOCATED_QR
@static if VERSION < v"1.7beta"
function init_cacheval(alg::QRFactorization{Val{false}}, A::Matrix{Float64}, b, u, Pl,
Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
PREALLOCATED_QR
end
else
function init_cacheval(alg::QRFactorization{NoPivot}, A::Matrix{Float64}, b, u, Pl, Pr,
maxiters::Int, abstol, reltol, verbose::Bool,
assumptions::OperatorAssumptions)
PREALLOCATED_QR
end
end

function init_cacheval(alg::QRFactorization, A::AbstractSciMLOperator, b, u, Pl, Pr,
Expand Down

0 comments on commit 8259a1d

Please sign in to comment.