Skip to content
Merged
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
4 changes: 2 additions & 2 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ function SciMLBase.solve(
# with the (zero-)initialized `u` instead of throwing.
u = prob.u0 !== nothing ? prob.u0 : __init_u0_from_Ab(prob.A, prob.b)
return SciMLBase.build_linear_solution(
alg, u, nothing, prob; retcode = ReturnCode.Failure
alg, u, nothing, nothing; retcode = ReturnCode.Failure
)
end
u = F \ prob.b
Expand All @@ -790,7 +790,7 @@ function SciMLBase.solve(
if !gesv_ok
u = prob.u0 !== nothing ? prob.u0 : __init_u0_from_Ab(prob.A, prob.b)
return SciMLBase.build_linear_solution(
alg, u, nothing, prob; retcode = ReturnCode.Failure
alg, u, nothing, nothing; retcode = ReturnCode.Failure
)
end
elseif alg isa QRFactorization
Expand Down
10 changes: 9 additions & 1 deletion test/Core/lightweight_solution.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LinearSolve, LinearAlgebra, SparseArrays, StableRNGs, Test
using LinearSolve, LinearAlgebra, SparseArrays, StableRNGs, StaticArrays, Test

# LinearSolve 5.0: `solve!`/`solve` return a lightweight `LinearSolution` that
# no longer carries the `LinearCache` (`sol.cache === nothing`). Anyone who
Expand Down Expand Up @@ -49,6 +49,14 @@ rng = StableRNG(7)
# also returns a cache-free solution
sol = solve!(init(LinearProblem(copy(Asing), copy(b)), nothing; verbose = false))
@test sol.cache === nothing

Astatic = @SMatrix [1.0 1.0; 1.0 1.0]
bstatic = @SVector [1.0, 1.0]
for alg in (LUFactorization(), GESVFactorization())
sol = solve(LinearProblem(Astatic, bstatic), alg)
@test sol.retcode == ReturnCode.Failure
@test sol.cache === nothing
end
end

@testset "warm aliased refactorize+solve loop is allocation-free" begin
Expand Down
Loading