Skip to content

Commit 03a444f

Browse files
Merge pull request #591 from ranocha/hr/pattern_changed
fix `pattern_changed`
2 parents cb11b26 + 32329dd commit 03a444f

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LinearSolve"
22
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
33
authors = ["SciML"]
4-
version = "3.7.0"
4+
version = "3.7.1"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

ext/LinearSolveSparseArraysExt.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module LinearSolveSparseArraysExt
33
using LinearSolve, LinearAlgebra
44
using SparseArrays
55
using SparseArrays: AbstractSparseMatrixCSC, nonzeros, rowvals, getcolptr
6-
using LinearSolve: BLASELTYPES
6+
using LinearSolve: BLASELTYPES, pattern_changed
77

88
# Can't `using KLU` because cannot have a dependency in there without
99
# requiring the user does `using KLU`
@@ -229,7 +229,7 @@ function LinearSolve._ldiv!(::LinearSolve.SVector,
229229
(A \ b)
230230
end
231231

232-
function pattern_changed(fact, A::SparseArrays.SparseMatrixCSC)
232+
function LinearSolve.pattern_changed(fact, A::SparseArrays.SparseMatrixCSC)
233233
!(SparseArrays.decrement(SparseArrays.getcolptr(A)) ==
234234
fact.colptr && SparseArrays.decrement(SparseArrays.getrowval(A)) ==
235235
fact.rowval)

test/basictests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,16 @@ end
523523
test_interface(nothing, prob3, prob4)
524524
end
525525
end
526+
527+
@testset "Sparse matrix (check pattern_changed)" begin
528+
n = 4
529+
A = spdiagm(1 => ones(n - 1), 0 => fill(2.0, n), -1 => ones(n - 1))
530+
b = rand(n)
531+
linprob = @inferred LinearProblem(A, b)
532+
alg = @inferred LUFactorization()
533+
linsolve = @inferred init(linprob, alg)
534+
linres = @inferred solve!(linsolve)
535+
end
526536
end # testset
527537

528538
# https://github.com/SciML/LinearSolve.jl/issues/347

0 commit comments

Comments
 (0)