Add `print_stats` method to `ode` and implement for `CVODE` integrator
The CVODE solver has a function called CVodePrintAllStats that prints statistics about the integration process, such as number of right-hand-side function evaluations and number of nonlinear solves.
This PR adds a method print_stats to the ode and CVode classes, such that user could print the above statistics in case, when they specify CVode as the integrator argument at the instantiation of the ode class.
CVodePrintAllStats allows to print the statistics and two different formats (as a formatted table or as a CSV file), to a given file stream (FILE * object). Right now I have narrowed it to always printing statistics to stdout as a formatted table.
@dmitry-kabanov If you're still interested in working on this, would you be able to rebase this on the latest master?
@aragilar Sure, I would be happy to do it. I have actually already rebased on the latest master, but have difficulties compiling the code via pip install -e . (from packages/scikit_sundials subdirectory).
I've created a separate issue about this #178.
@aragilar I have rebased the PR on the latest master right now and have tested that it works with the following script:
import numpy as np
from scikits_odes import ode
def rhs(t, y, ydot):
ydot[:] = -y
t0 = 0.0
y0 = [1.0]
s = ode("cvode", rhs, old_api=False)
sol = s.solve(np.linspace(t0, t0 + 1, 11), y0)
print(sol.values.y[:, 0])
s.print_stats()