I am trying to solve a differential equation system
$$x´=Ax\quad \text{with } x(0) = f(x)$$
in Python, where $A$ indeed is a complex sparse matrix.
For now i have been solving the system using the scipy.integrate.complex_ode
class in the following way.
def to_solver_function(time,vector):
sendoff = np.dot(A, np.transpose(vector))
return sendoff
solver = complex_ode(to_solver_function)
solver.set_initial_value(f(x),0)
solution = [f(x)]
for time in time_grid:
next = solver.integrate(time)
solution.append(next)
This has been working OK, but I need to "tell the solver" that my matrix is sparse. I figured out that I should use
Asparse = sparse.lil_matrix(A)
but how do I change my solver to work with this?