Skip to content

fix pattern_changed #591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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,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"
Expand Down
2 changes: 1 addition & 1 deletion ext/LinearSolveSparseArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions test/basictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading