Skip to content

Commit d69b1a2

Browse files
Add check call to getrf! (#50134)
* Add check call to getrf! `lu!(A; check=false)` is supposed to disable the checking and leave it to the user: > When check = true, an error is thrown if the decomposition fails. When check = false, responsibility for checking the decomposition's validity (via issuccess) lies with the user. However, this is not quite true since `lu!` calls `getrf!` which internally does a check for `chkfinite` which does throw an error. This updates the `getrf!` function to have a `check` argument which is then used by `lu!` to fully disable the error throwing checks. * Update lapack.jl
1 parent 75bda64 commit d69b1a2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

stdlib/LinearAlgebra/src/lapack.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,9 @@ for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty
554554
# * .. Array Arguments ..
555555
# INTEGER IPIV( * )
556556
# DOUBLE PRECISION A( LDA, * )
557-
function getrf!(A::AbstractMatrix{$elty})
557+
function getrf!(A::AbstractMatrix{$elty}; check = true)
558558
require_one_based_indexing(A)
559-
chkfinite(A)
559+
check && chkfinite(A)
560560
chkstride1(A)
561561
m, n = size(A)
562562
lda = max(1,stride(A, 2))

stdlib/LinearAlgebra/src/lu.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ transpose(F::LU{<:Real}) = TransposeFactorization(F)
7979
# the following method is meant to catch calls to lu!(A::LAPACKArray) without a pivoting stategy
8080
lu!(A::StridedMatrix{<:BlasFloat}; check::Bool = true) = lu!(A, RowMaximum(); check=check)
8181
function lu!(A::StridedMatrix{T}, ::RowMaximum; check::Bool = true) where {T<:BlasFloat}
82-
lpt = LAPACK.getrf!(A)
82+
lpt = LAPACK.getrf!(A; check)
8383
check && checknonsingular(lpt[3])
8484
return LU{T,typeof(lpt[1]),typeof(lpt[2])}(lpt[1], lpt[2], lpt[3])
8585
end

0 commit comments

Comments
 (0)