API
- class pydiffsol.MatrixType
Bases:
object- classmethod all()
Get all available matrix types :return: list of MatrixType
- classmethod from_str(name)
Create MatrixType from string name :param name: string representation of matrix type :return: valid MatrixType or exception if name is invalid
- faer_dense_f64 = MatrixType.faer_dense_f64
- faer_sparse_f64 = MatrixType.faer_sparse_f64
- nalgebra_dense_f64 = MatrixType.nalgebra_dense_f64
- class pydiffsol.Ode(code, matrix_type=Ellipsis, method=Ellipsis, linear_solver=Ellipsis)
Bases:
object- solve(params, final_time)
Using the provided state, solve the problem up to time final_time.
The number of params must match the expected params in the diffsl code. If specified, the config can be used to override the solver method (Bdf by default) and SolverType (Lu by default) along with other solver params like rtol.
- Parameters:
params (numpy.ndarray) – 1D array of solver parameters
final_time (float) – end time of solver
config (pydiffsol.Config, optional) – optional solver configuration
- Returns:
(ys, ts) tuple where ys is a 2D array of values at times ts chosen by the solver
- Return type:
Tuple[numpy.ndarray, numpy.ndarray]
Example
>>> print(ode.solve(np.array([]), 0.5))
- solve_dense(params, t_eval)
Using the provided state, solve the problem up to time t_eval[t_eval.len()-1]. Returns 2D array of solution values at timepoints given by t_eval.
The number of params must match the expected params in the diffsl code. The config may be optionally specified to override solver settings.
- Parameters:
params (numpy.ndarray) – 1D array of solver parameters
t_eval – 1D array of solver times
config (pydiffsol.Config, optional) – optional solver configuration
- Returns:
2D array of values at times t_eval
- Return type:
numpy.ndarray
- atol
- code
Get the DiffSl compiled to generate this ODE
- linear_solver
- matrix_type
- method
- rtol
- class pydiffsol.SolverMethod
Bases:
object- classmethod all()
- classmethod from_str(value)
- bdf = SolverMethod.bdf
- esdirk34 = SolverMethod.esdirk34
- tr_bdf2 = SolverMethod.tr_bdf2
- tsit45 = SolverMethod.tsit45
- class pydiffsol.SolverType
Bases:
object- classmethod all()
- classmethod from_str(value)
- default = SolverType.default
- klu = SolverType.klu
- lu = SolverType.lu
- pydiffsol.is_klu_available()
Determine whether Klu functions are available in this build of pydiffsol. This depends on whether the library was built with suitesparse support.
- pydiffsol.version()
Get version of this pydiffsol module