Skip to content

Commit

Permalink
Merge pull request #210 from SciML/rk/fix_umfpack
Browse files Browse the repository at this point in the history
Use new ctor in 1.9
  • Loading branch information
YingboMa authored Oct 20, 2022
2 parents cbeca68 + 28d5b79 commit cbbf8d1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,17 @@ function init_cacheval(alg::UMFPACKFactorization, A, b, u, Pl, Pr, maxiters::Int
verbose::Bool, assumptions::OperatorAssumptions)
A = convert(AbstractMatrix, A)
zerobased = SparseArrays.getcolptr(A)[1] == 0
res = SuiteSparse.UMFPACK.UmfpackLU(C_NULL, C_NULL, size(A, 1), size(A, 2),
zerobased ? copy(SparseArrays.getcolptr(A)) :
SuiteSparse.decrement(SparseArrays.getcolptr(A)),
zerobased ? copy(rowvals(A)) :
SuiteSparse.decrement(rowvals(A)),
copy(nonzeros(A)), 0)
finalizer(SuiteSparse.UMFPACK.umfpack_free_symbolic, res)
res
@static if VERSION < v"1.9.0-DEV.1622"
return SuiteSparse.UMFPACK.UmfpackLU(C_NULL, C_NULL, size(A, 1), size(A, 2),
zerobased ? copy(SparseArrays.getcolptr(A)) :
SuiteSparse.decrement(SparseArrays.getcolptr(A)),
zerobased ? copy(rowvals(A)) :
SuiteSparse.decrement(rowvals(A)),
copy(nonzeros(A)), 0)
finalizer(SuiteSparse.UMFPACK.umfpack_free_symbolic, res)
else
return SuiteSparse.UMFPACK.UmfpackLU(A)
end
end

function SciMLBase.solve(cache::LinearCache, alg::UMFPACKFactorization; kwargs...)
Expand Down

0 comments on commit cbbf8d1

Please sign in to comment.