Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LinearSolve"
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
version = "3.86.1"
version = "3.86.2"
authors = ["SciML"]

[deps]
Expand Down
27 changes: 27 additions & 0 deletions test/Core/sized_matrix.jl
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading