From 290c82f50ecd0c81ea15d4d034de26edfee2c0eb Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Mon, 19 Jun 2023 00:45:36 -0400 Subject: [PATCH 1/3] Fix QR initializations with pivoting Fixes https://github.com/SciML/LinearSolve.jl/issues/335 --- Project.toml | 2 +- src/factorization.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 769a94fb7..a2ad3f84e 100644 --- a/Project.toml +++ b/Project.toml @@ -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" diff --git a/src/factorization.jl b/src/factorization.jl index 53f0ec770..a7e353812 100644 --- a/src/factorization.jl +++ b/src/factorization.jl @@ -171,12 +171,12 @@ 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, +function init_cacheval(alg::QRFactorization{NoPivot}, A::Matrix{Float64}, b, u, Pl, Pr, maxiters::Int, abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions) PREALLOCATED_QR From faec56dbc21f7c7bbd698bbeef7e47b3753c8c7e Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Mon, 19 Jun 2023 02:05:43 -0400 Subject: [PATCH 2/3] fix v1.6 --- src/factorization.jl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/factorization.jl b/src/factorization.jl index a7e353812..a52f4d92f 100644 --- a/src/factorization.jl +++ b/src/factorization.jl @@ -176,10 +176,18 @@ end const PREALLOCATED_QR = ArrayInterface.qr_instance(rand(1, 1)) -function init_cacheval(alg::QRFactorization{NoPivot}, 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, From acdc581aa235a543127dcfec6eaa5dc8fb48b34c Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Mon, 19 Jun 2023 02:15:09 -0400 Subject: [PATCH 3/3] format --- src/factorization.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/factorization.jl b/src/factorization.jl index a52f4d92f..2ab063cfb 100644 --- a/src/factorization.jl +++ b/src/factorization.jl @@ -177,7 +177,8 @@ end const PREALLOCATED_QR = ArrayInterface.qr_instance(rand(1, 1)) @static if VERSION < v"1.7beta" - function init_cacheval(alg::QRFactorization{Val{false}}, A::Matrix{Float64}, b, u, Pl, Pr, + function init_cacheval(alg::QRFactorization{Val{false}}, A::Matrix{Float64}, b, u, Pl, + Pr, maxiters::Int, abstol, reltol, verbose::Bool, assumptions::OperatorAssumptions) PREALLOCATED_QR