From c350410e831c4eeba5b4d65e7b827ac7c681ef75 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Fri, 26 Sep 2025 17:41:50 -0400 Subject: [PATCH 1/4] Fix negative info values for NoPivot() on Julia 1.11+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Julia 1.11 changed the convention for LU factorization info field when using NoPivot(). Now, when a zero diagonal is encountered during unpivoted LU factorization, the info field should be negative to distinguish it from pivoted factorization failures. This commit updates RecursiveFactorization to match Julia's convention: - In _generic_lufact!, return negative info when Pivot=false and zero diagonal found - In reckernel!, handle negative info values correctly when adjusting offsets Fixes #95 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/lu.jl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lu.jl b/src/lu.jl index 667e146..5375e3c 100644 --- a/src/lu.jl +++ b/src/lu.jl @@ -235,7 +235,14 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b # A21 <- P2 A21 Pivot && apply_permutation!(P2, A21, thread) - info != previnfo && (info += n1) + if info != previnfo + # Handle negative info for NoPivot (Julia 1.11+ convention) + if info < 0 + info -= n1 + else + info += n1 + end + end if Pivot @turbo warn_check_args=false for i in 1:n2 P2[i] += n1 @@ -303,6 +310,10 @@ function _generic_lufact!(A, ::Val{Pivot}, ipiv, info) where {Pivot} end elseif info == 0 info = k + # Julia 1.11+ convention: negative info for NoPivot + if !Pivot + info = -info + end end k == minmn && break # Update the rest From f251c5c3449e75dd2fb327c1ee7e1f2d50506f7d Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Fri, 26 Sep 2025 17:48:38 -0400 Subject: [PATCH 2/4] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 074ea5a..b114edd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - julia-version: ['1'] + julia-version: ['lts','1','pre'] threads: - '1' - '3' From 3c0413572f720a97c55925a4832d9bc681f63264 Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Fri, 26 Sep 2025 17:51:04 -0400 Subject: [PATCH 3/4] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b114edd..78c473f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - uses: actions/checkout@v4 - - uses: julia-actions/setup-julia@v1 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - uses: actions/cache@v4 From 6942c0bd4e34241c49f70bef57d58f2c99ffaa04 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Fri, 26 Sep 2025 17:58:34 -0400 Subject: [PATCH 4/4] Add VERSION check for Julia 1.11+ negative info convention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/lu.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lu.jl b/src/lu.jl index 5375e3c..78854ad 100644 --- a/src/lu.jl +++ b/src/lu.jl @@ -21,6 +21,8 @@ function lu(A::AbstractMatrix, pivot = Val(true), thread = Val(false); kwargs... end const CUSTOMIZABLE_PIVOT = VERSION >= v"1.8.0-DEV.1507" +# Julia 1.11+ uses negative info for NoPivot() failures +const NOPIVOT_NEGATIVE_INFO = VERSION >= v"1.11.0-DEV" struct NotIPIV <: AbstractVector{BlasInt} len::Int @@ -237,7 +239,7 @@ function reckernel!(A::AbstractMatrix{T}, pivot::Val{Pivot}, m, n, ipiv, info, b if info != previnfo # Handle negative info for NoPivot (Julia 1.11+ convention) - if info < 0 + if NOPIVOT_NEGATIVE_INFO && info < 0 info -= n1 else info += n1 @@ -311,7 +313,7 @@ function _generic_lufact!(A, ::Val{Pivot}, ipiv, info) where {Pivot} elseif info == 0 info = k # Julia 1.11+ convention: negative info for NoPivot - if !Pivot + if !Pivot && NOPIVOT_NEGATIVE_INFO info = -info end end