From 540e4586db6bc0e58bc02f7f9f69d99ff7adea28 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 27 Mar 2025 15:26:49 +0100 Subject: [PATCH 1/3] fix pattern_changed --- ext/LinearSolveSparseArraysExt.jl | 2 +- test/basictests.jl | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ext/LinearSolveSparseArraysExt.jl b/ext/LinearSolveSparseArraysExt.jl index 24d9f3517..385e1174a 100644 --- a/ext/LinearSolveSparseArraysExt.jl +++ b/ext/LinearSolveSparseArraysExt.jl @@ -229,7 +229,7 @@ function LinearSolve._ldiv!(::LinearSolve.SVector, (A \ b) end -function pattern_changed(fact, A::SparseArrays.SparseMatrixCSC) +function LinearSolve.pattern_changed(fact, A::SparseArrays.SparseMatrixCSC) !(SparseArrays.decrement(SparseArrays.getcolptr(A)) == fact.colptr && SparseArrays.decrement(SparseArrays.getrowval(A)) == fact.rowval) diff --git a/test/basictests.jl b/test/basictests.jl index 3b5f9ad48..005b71b79 100644 --- a/test/basictests.jl +++ b/test/basictests.jl @@ -523,6 +523,16 @@ end test_interface(nothing, prob3, prob4) end end + + @testset "Sparse matrix (check pattern_changed)" begin + n = 4 + A = spdiagm(1 => ones(n - 1), 0 => fill(2.0, n), -1 => ones(n - 1)) + b = rand(n) + linprob = @inferred LinearProblem(A, b) + alg = @inferred LUFactorization() + linsolve = @inferred init(linprob, alg) + linres = @inferred solve!(linsolve) + end end # testset # https://github.com/SciML/LinearSolve.jl/issues/347 From 051ed6ba5050bef880c3f7f55dd7487348cee0c6 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 27 Mar 2025 15:28:57 +0100 Subject: [PATCH 2/3] bump patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 1690e4a90..9958a4fe4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LinearSolve" uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" authors = ["SciML"] -version = "3.7.0" +version = "3.7.1" [deps] ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" From 32329dda9245c6fa71aa4762e40f0644a2896523 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 27 Mar 2025 20:02:35 +0100 Subject: [PATCH 3/3] fix missing import of pattern_changed --- ext/LinearSolveSparseArraysExt.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/LinearSolveSparseArraysExt.jl b/ext/LinearSolveSparseArraysExt.jl index 385e1174a..f88d68f1a 100644 --- a/ext/LinearSolveSparseArraysExt.jl +++ b/ext/LinearSolveSparseArraysExt.jl @@ -3,7 +3,7 @@ module LinearSolveSparseArraysExt using LinearSolve, LinearAlgebra using SparseArrays using SparseArrays: AbstractSparseMatrixCSC, nonzeros, rowvals, getcolptr -using LinearSolve: BLASELTYPES +using LinearSolve: BLASELTYPES, pattern_changed # Can't `using KLU` because cannot have a dependency in there without # requiring the user does `using KLU`