Skip to content

Commit 84e567d

Browse files
Merge pull request #100 from ChrisRackauckas-Claude/fix-negative-info-nopivot
Fix negative info values for NoPivot() on Julia 1.11+
2 parents 3cb6959 + 6942c0b commit 84e567d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
julia-version: ['1']
15+
julia-version: ['lts','1','pre']
1616
threads:
1717
- '1'
1818
- '3'
1919
os: [ubuntu-latest, windows-latest, macOS-latest]
2020
steps:
2121
- uses: actions/checkout@v4
22-
- uses: julia-actions/setup-julia@v1
22+
- uses: julia-actions/setup-julia@v2
2323
with:
2424
version: ${{ matrix.julia-version }}
2525
- uses: actions/cache@v4

src/lu.jl

Lines changed: 14 additions & 1 deletion
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
@@ -235,7 +237,14 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b
235237
# A21 <- P2 A21
236238
Pivot && apply_permutation!(P2, A21, thread)
237239

238-
info != previnfo && (info += n1)
240+
if info != previnfo
241+
# Handle negative info for NoPivot (Julia 1.11+ convention)
242+
if NOPIVOT_NEGATIVE_INFO && info < 0
243+
info -= n1
244+
else
245+
info += n1
246+
end
247+
end
239248
if Pivot
240249
@turbo warn_check_args=false for i in 1:n2
241250
P2[i] += n1
@@ -303,6 +312,10 @@ function _generic_lufact!(A, ::Val{Pivot}, ipiv, info) where {Pivot}
303312
end
304313
elseif info == 0
305314
info = k
315+
# Julia 1.11+ convention: negative info for NoPivot
316+
if !Pivot && NOPIVOT_NEGATIVE_INFO
317+
info = -info
318+
end
306319
end
307320
k == minmn && break
308321
# Update the rest

0 commit comments

Comments
 (0)