Skip to content

Commit 6942c0b

Browse files
Add VERSION check for Julia 1.11+ negative info convention
Only use negative info values for NoPivot() on Julia 1.11 and later. Earlier versions should continue using positive info values. - Added NOPIVOT_NEGATIVE_INFO constant that checks Julia version - Use this constant to conditionally apply negative info values - Ensures backward compatibility with Julia < 1.11 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3c04135 commit 6942c0b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lu.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ function lu(A::AbstractMatrix, pivot = Val(true), thread = Val(false); kwargs...
2121
end
2222

2323
const CUSTOMIZABLE_PIVOT = VERSION >= v"1.8.0-DEV.1507"
24+
# Julia 1.11+ uses negative info for NoPivot() failures
25+
const NOPIVOT_NEGATIVE_INFO = VERSION >= v"1.11.0-DEV"
2426

2527
struct NotIPIV <: AbstractVector{BlasInt}
2628
len::Int
@@ -237,7 +239,7 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b
237239

238240
if info != previnfo
239241
# Handle negative info for NoPivot (Julia 1.11+ convention)
240-
if info < 0
242+
if NOPIVOT_NEGATIVE_INFO && info < 0
241243
info -= n1
242244
else
243245
info += n1
@@ -311,7 +313,7 @@ function _generic_lufact!(A, ::Val{Pivot}, ipiv, info) where {Pivot}
311313
elseif info == 0
312314
info = k
313315
# Julia 1.11+ convention: negative info for NoPivot
314-
if !Pivot
316+
if !Pivot && NOPIVOT_NEGATIVE_INFO
315317
info = -info
316318
end
317319
end

0 commit comments

Comments
 (0)