[diffeqpy] with sparse mass-matrix / jacobian


I have a moderately-complex Python script which involves a DAE system solve at its core:
M(u) dudt = F(u)
The matrices M and J (the Jacobian of F(x)) are both sparse, and I need to exploit for this large system. It appears that Julia can solve equations of this class:

Since it would be very difficult and time-consumming to convert my entire Python implementation over to Julia, I attempted to use “diffeqpy” package, which calls many of Julia’s powerful solvers:

Unfortunately, these functions do not appear to be compatible with SciPy sparse matrices as input. In this example, I have to pass dense A,J matrices for it to work:

fun = de.ODEFunction(System_F_Julia,mass_matrix=A.toarray(),jac_prototype=J.toarray())
prob = de.ODEProblem(fun, initial_state, tspan, args)
sol = de.solve(prob,de.Rosenbrock23(autodiff=False))

So here is the question:
Is there an effective method to use the diffeqpy package with sparse mass matrix / jacobian? Is there a way to convert/reconstruct the SciPy sparse matrices into Julia-compatible sparse matrices for input to the above code?

Any help is much appreciated!

See, for example: Convert to sparse · Issue #204 · JuliaPy/PyCall.jl · GitHub