Skip to content

Commit

Permalink
Merge pull request #50525 from oscardssmith/fix-generic_lu_fact-check…
Browse files Browse the repository at this point in the history
…=false

only check that values are finite in `generic_lufact`  when `check=true`
  • Loading branch information
oscardssmith committed Jul 13, 2023
2 parents 9122376 + 6ef6a0c commit 824cdf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/src/lu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ lu!(A::AbstractMatrix, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype
generic_lufact!(A, pivot; check = check)
function generic_lufact!(A::AbstractMatrix{T}, pivot::Union{RowMaximum,NoPivot,RowNonZero} = lupivottype(T);
check::Bool = true) where {T}
LAPACK.chkfinite(A)
check && LAPACK.chkfinite(A)
# Extract values
m, n = size(A)
minmn = min(m,n)
Expand Down
7 changes: 7 additions & 0 deletions stdlib/LinearAlgebra/test/lu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -464,4 +464,11 @@ end
@test Matrix(F1) Matrix(F2) C
end

@testset "matrix with Nonfinite" begin
lu(fill(NaN, 2, 2), check=false)
lu(fill(Inf, 2, 2), check=false)
LinearAlgebra.generic_lufact!(fill(NaN, 2, 2), check=false)
LinearAlgebra.generic_lufact!(fill(Inf, 2, 2), check=false)
end

end # module TestLU

0 comments on commit 824cdf1

Please sign in to comment.