Skip to content

Commit 6643177

Browse files
fix KLU and sparse matrix support
1 parent 81e7955 commit 6643177

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/types_and_consts_additions.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function Base.convert(::Type{SparseArrays.SparseMatrixCSC}, J::SUNMatrix)
4343
# TODO: Get rid of allocation for 1-based index change
4444
rowval = unsafe_wrap(Array, mat.indexvals, (mat.NNZ), own=false)
4545
colptr = unsafe_wrap(Array, mat.indexptrs, (mat.NP+1), own=false)
46+
colptr .+= 1
4647
m = mat.M
4748
n = mat.N
4849
nzval = unsafe_wrap(Array,mat.data, (mat.NNZ), own=false)

test/common_interface/jacobians.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ Lotka_f = ODEFunction(Lotka,jac=Lotka_jac,
2828

2929
prob = ODEProblem(Lotka_f,ones(2),(0.0,10.0))
3030
jac_called = false
31-
@test_broken sol9 = solve(prob,CVODE_BDF(linear_solver=:KLU))
32-
@test_broken jac_called == true
31+
sol9 = solve(prob,CVODE_BDF(linear_solver=:KLU))
32+
@test jac_called == true
33+
@test Array(sol9) Array(good_sol)
3334

3435
Lotka_fj = ODEFunction(Lotka,
3536
jac_prototype = JacVecOperator{Float64}(Lotka,ones(2)))

0 commit comments

Comments
 (0)