From 3cdaacc5e5bed0cacd06dfc975c685523f33c88c Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Fri, 26 Jun 2026 15:02:02 -0400 Subject: [PATCH] Release v3.86.2 with SizedMatrix init_cacheval fix + regression test The `init_cacheval(::GenericLUFactorization/::RFLUFactorization)` regression for `SizedMatrix` (StaticArrays.LU has no `factors`/`info` field) was fixed in #1056/#1053 but never released: `Project.toml` still read `3.86.1`, identical to the registered release, so OrdinaryDiffEq CI kept installing the buggy v3.86.1 and the "Sized Matrix Tests" (Rodas4 over a `SizedMatrix` state) errored with `type StaticArrays.LU has no field factors`. Bump to 3.86.2 so the fix ships, and add test/Core/sized_matrix.jl covering the `init_cacheval` path that threw: `init` of a `LinearProblem{SizedMatrix}` with the default solver and with explicit `GenericLUFactorization`/`RFLUFactorization`. The test errors on v3.86.1 with the exact `FieldError` and passes on main. Co-Authored-By: Chris Rackauckas --- Project.toml | 2 +- test/Core/sized_matrix.jl | 27 +++++++++++++++++++++++++++ test/runtests.jl | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 test/Core/sized_matrix.jl diff --git a/Project.toml b/Project.toml index 5f8f811ee..207955ffd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LinearSolve" uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -version = "3.86.1" +version = "3.86.2" authors = ["SciML"] [deps] diff --git a/test/Core/sized_matrix.jl b/test/Core/sized_matrix.jl new file mode 100644 index 000000000..5200b8cda --- /dev/null +++ b/test/Core/sized_matrix.jl @@ -0,0 +1,27 @@ +using LinearSolve, StaticArrays, RecursiveFactorization, LinearAlgebra, Test + +# A `SizedMatrix` (StaticArrays) is an in-place, dense matrix whose +# `ArrayInterface.lu_instance` returns a `StaticArrays.LU` (fields `L`/`U`/`p`), +# not a `LinearAlgebra.LU`. `init_cacheval` for `GenericLUFactorization` / +# `RFLUFactorization` must not assume `lu_instance` yields a `LinearAlgebra.LU` +# and reach for its `factors`/`info` fields. Regression for +# SciML/LinearSolve.jl#1056: `init` used to throw +# `type StaticArrays.LU has no field factors`, which broke the downstream +# OrdinaryDiffEq "Sized Matrix Tests" (`Rodas4` over a `SizedMatrix` state, whose +# default solver initializes the `GenericLU`/`RFLU` cachevals). + +A = SizedMatrix{9, 9}(rand(9, 9) + 9I) +b = SizedVector{9}(rand(9)) + +# `init` is where `init_cacheval` runs; this is the call that used to throw. +@testset "init does not assume LinearAlgebra.LU for $(typeof(alg))" for alg in ( + LinearSolve.GenericLUFactorization(), LinearSolve.RFLUFactorization(), + ) + @test init(LinearProblem(A, b), alg) isa LinearSolve.LinearCache +end + +@testset "default init/solve LinearProblem(SizedMatrix)" begin + cache = init(LinearProblem(A, b)) + sol = solve!(cache) + @test sol.retcode == ReturnCode.Success +end diff --git a/test/runtests.jl b/test/runtests.jl index 118343b96..bfd9cdfb9 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -70,6 +70,7 @@ else @time @safetestset "Nonstructural Zeros" include("Core/nonstructural_zeros.jl") @time @safetestset "Default Alg Tests" include("Core/default_algs.jl") @time @safetestset "FixedSizeArrays" include("Core/fixedsizearrays.jl") + @time @safetestset "SizedMatrix" include("Core/sized_matrix.jl") @time @safetestset "Adjoint Sensitivity" include("Core/adjoint.jl") @time @safetestset "ForwardDiff Overloads" include("Core/forwarddiff_overloads.jl") @time @safetestset "Traits" include("Core/traits.jl")