pyodesys.native package¶
pyodesys.native¶
This module contains a pyodesys.symbolic.SymbolicSys
subclass which can be used to generate
source code representing the system of equations in a native language.
For some integrators (Sundials and GSL), the compiled objects from the
generated code are dynamically linked against respective library. You
may need to match the choice of BLAS/LAPACK implementation to link against.
This can be modified by setting the environment variables PYODESYS_LBLAS
and PYODESYS_LLAPACK
respectively.
Submodules¶
pyodesys.native.cvode module¶
-
class
pyodesys.native.cvode.
NativeCvodeCode
(*args, **kwargs)[source]¶ Bases:
pyodesys.native._base._NativeCodeBase
- Attributes
- binary_path
- compile_kwargs
- extension_name
mod
Cached compiled binary of the Generic_Code class.
- so_file
Methods
clean
(self)Delete temp dir if not save_temp set at __init__
compile_and_import_binary
(self)Returnes a module instance of the extension module.
get_cse_code
(self, exprs[, basename, …])Get arrayified code for common subexpression.
variables
(self)Returns dictionary of variables for substituion suitable for use in the templates (formated according to the syntax of the language)
CompilerRunner
as_arrayified_code
clear_mod_cache
write_code
-
namespace
= {'p_baseclass': 'OdeSysIterativeBase', 'p_includes': ['"odesys_anyode_iterative.hpp"'], 'p_indextype': 'int', 'p_jacobian_set_to_zero_by_solver': True, 'p_realtype': 'double', 'p_support_recoverable_error': True}¶
-
wrapper_name
= '_cvode_wrapper'¶
-
class
pyodesys.native.cvode.
NativeCvodeSys
(*args, **kwargs)[source]¶ Bases:
pyodesys.native._base._NativeSysBase
- Attributes
- linear_invariants
ny
Number of dependent variables in the system.
Methods
adaptive
(self, y0, x0, xend[, params])Integrate with integrator chosen output.
analytic_stiffness
(self[, xyp])Running stiffness ratio from last integration.
chained_parameter_variation
(self, \*args, …)See
chained_parameter_variation()
.from_callback
(rhs[, ny, nparams, …])Create an instance from a callback.
from_other
(ori, \*\*kwargs)Creates a new instance with an existing one as a template.
from_other_new_params
(ori, par_subs, new_pars)Creates a new instance with an existing one as a template (with new parameters)
from_other_new_params_by_name
(ori, par_subs)Creates a new instance with an existing one as a template (with new parameters)
get_dfdx
(self)Calculates 2nd derivatives of
self.exprs
get_dfdx_callback
(self)Generate a callback for evaluating derivative of
self.exprs
get_f_ty_callback
(self)Generates a callback for evaluating
self.exprs
.get_j_ty_callback
(self)Generates a callback for evaluating the jacobian.
get_jac
(self)Derives the jacobian from
self.exprs
andself.dep
.get_jtimes
(self)Derive the jacobian-vector product from
self.exprs
andself.dep
get_jtimes_callback
(self)Generate a callback fro evaluating the jacobian-vector product.
get_roots_callback
(self)Generate a callback for evaluating
self.roots
integrate
(self, \*args, \*\*kwargs)Integrate the system of ordinary differential equations.
jacobian_singular
(self)Returns True if Jacobian is singular, else False.
plot_phase_plane
(self[, indices])Plots a phase portrait from last integration.
plot_result
(self, \*\*kwargs)Plots the integrated dependent variables from last integration.
post_process
(self, xout, yout, params)Transforms internal values to output, used internally.
pre_process
(self, xout, y0[, params])Transforms input to internal values, used internally.
predefined
(self, y0, xout[, params])Integrate with user chosen output.
stiffness
(self[, xyp, eigenvals_cb])[DEPRECATED] Use
Result.stiffness()
, stiffness rationall_invariant_names
all_invariants
as_autonomous
as_standalone
get_first_step_callback
get_invariants_callback
to_arrays
pyodesys.native.gsl module¶
-
class
pyodesys.native.gsl.
NativeGSLCode
(*args, **kwargs)[source]¶ Bases:
pyodesys.native._base._NativeCodeBase
Looks for the environment variable:
PYODESYS_BLAS
(gslcblas
)- Attributes
- binary_path
- compile_kwargs
- extension_name
mod
Cached compiled binary of the Generic_Code class.
- so_file
Methods
clean
(self)Delete temp dir if not save_temp set at __init__
compile_and_import_binary
(self)Returnes a module instance of the extension module.
get_cse_code
(self, exprs[, basename, …])Get arrayified code for common subexpression.
variables
(self)Returns dictionary of variables for substituion suitable for use in the templates (formated according to the syntax of the language)
CompilerRunner
as_arrayified_code
clear_mod_cache
write_code
-
wrapper_name
= '_gsl_wrapper'¶
-
class
pyodesys.native.gsl.
NativeGSLSys
(*args, **kwargs)[source]¶ Bases:
pyodesys.native._base._NativeSysBase
- Attributes
- linear_invariants
ny
Number of dependent variables in the system.
Methods
adaptive
(self, y0, x0, xend[, params])Integrate with integrator chosen output.
analytic_stiffness
(self[, xyp])Running stiffness ratio from last integration.
chained_parameter_variation
(self, \*args, …)See
chained_parameter_variation()
.from_callback
(rhs[, ny, nparams, …])Create an instance from a callback.
from_other
(ori, \*\*kwargs)Creates a new instance with an existing one as a template.
from_other_new_params
(ori, par_subs, new_pars)Creates a new instance with an existing one as a template (with new parameters)
from_other_new_params_by_name
(ori, par_subs)Creates a new instance with an existing one as a template (with new parameters)
get_dfdx
(self)Calculates 2nd derivatives of
self.exprs
get_dfdx_callback
(self)Generate a callback for evaluating derivative of
self.exprs
get_f_ty_callback
(self)Generates a callback for evaluating
self.exprs
.get_j_ty_callback
(self)Generates a callback for evaluating the jacobian.
get_jac
(self)Derives the jacobian from
self.exprs
andself.dep
.get_jtimes
(self)Derive the jacobian-vector product from
self.exprs
andself.dep
get_jtimes_callback
(self)Generate a callback fro evaluating the jacobian-vector product.
get_roots_callback
(self)Generate a callback for evaluating
self.roots
integrate
(self, \*args, \*\*kwargs)Integrate the system of ordinary differential equations.
jacobian_singular
(self)Returns True if Jacobian is singular, else False.
plot_phase_plane
(self[, indices])Plots a phase portrait from last integration.
plot_result
(self, \*\*kwargs)Plots the integrated dependent variables from last integration.
post_process
(self, xout, yout, params)Transforms internal values to output, used internally.
pre_process
(self, xout, y0[, params])Transforms input to internal values, used internally.
predefined
(self, y0, xout[, params])Integrate with user chosen output.
stiffness
(self[, xyp, eigenvals_cb])[DEPRECATED] Use
Result.stiffness()
, stiffness rationall_invariant_names
all_invariants
as_autonomous
get_first_step_callback
get_invariants_callback
to_arrays
pyodesys.native.odeint module¶
-
class
pyodesys.native.odeint.
NativeOdeintCode
(*args, **kwargs)[source]¶ Bases:
pyodesys.native._base._NativeCodeBase
- Attributes
- binary_path
- compile_kwargs
- extension_name
mod
Cached compiled binary of the Generic_Code class.
- so_file
Methods
clean
(self)Delete temp dir if not save_temp set at __init__
compile_and_import_binary
(self)Returnes a module instance of the extension module.
get_cse_code
(self, exprs[, basename, …])Get arrayified code for common subexpression.
variables
(self)Returns dictionary of variables for substituion suitable for use in the templates (formated according to the syntax of the language)
CompilerRunner
as_arrayified_code
clear_mod_cache
write_code
-
wrapper_name
= '_odeint_wrapper'¶
-
class
pyodesys.native.odeint.
NativeOdeintSys
(*args, **kwargs)[source]¶ Bases:
pyodesys.native._base._NativeSysBase
- Attributes
- linear_invariants
ny
Number of dependent variables in the system.
Methods
adaptive
(self, y0, x0, xend[, params])Integrate with integrator chosen output.
analytic_stiffness
(self[, xyp])Running stiffness ratio from last integration.
chained_parameter_variation
(self, \*args, …)See
chained_parameter_variation()
.from_callback
(rhs[, ny, nparams, …])Create an instance from a callback.
from_other
(ori, \*\*kwargs)Creates a new instance with an existing one as a template.
from_other_new_params
(ori, par_subs, new_pars)Creates a new instance with an existing one as a template (with new parameters)
from_other_new_params_by_name
(ori, par_subs)Creates a new instance with an existing one as a template (with new parameters)
get_dfdx
(self)Calculates 2nd derivatives of
self.exprs
get_dfdx_callback
(self)Generate a callback for evaluating derivative of
self.exprs
get_f_ty_callback
(self)Generates a callback for evaluating
self.exprs
.get_j_ty_callback
(self)Generates a callback for evaluating the jacobian.
get_jac
(self)Derives the jacobian from
self.exprs
andself.dep
.get_jtimes
(self)Derive the jacobian-vector product from
self.exprs
andself.dep
get_jtimes_callback
(self)Generate a callback fro evaluating the jacobian-vector product.
get_roots_callback
(self)Generate a callback for evaluating
self.roots
integrate
(self, \*args, \*\*kwargs)Integrate the system of ordinary differential equations.
jacobian_singular
(self)Returns True if Jacobian is singular, else False.
plot_phase_plane
(self[, indices])Plots a phase portrait from last integration.
plot_result
(self, \*\*kwargs)Plots the integrated dependent variables from last integration.
post_process
(self, xout, yout, params)Transforms internal values to output, used internally.
pre_process
(self, xout, y0[, params])Transforms input to internal values, used internally.
predefined
(self, y0, xout[, params])Integrate with user chosen output.
stiffness
(self[, xyp, eigenvals_cb])[DEPRECATED] Use
Result.stiffness()
, stiffness rationall_invariant_names
all_invariants
as_autonomous
get_first_step_callback
get_invariants_callback
to_arrays