From 24cf079e6abb3baf44034de37d1c3c0a764501b1 Mon Sep 17 00:00:00 2001 From: Will Kimmerer Date: Thu, 20 Oct 2022 12:27:05 -0400 Subject: [PATCH] Add static if for 1.9 --- src/factorization.jl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/factorization.jl b/src/factorization.jl index f2fb8207a..e4a2e3cf4 100644 --- a/src/factorization.jl +++ b/src/factorization.jl @@ -274,14 +274,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" + 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...)