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" diff --git a/ext/LinearSolveSparseArraysExt.jl b/ext/LinearSolveSparseArraysExt.jl index 24d9f3517..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` @@ -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