amici.ode_export
C++ Export
This module provides all necessary functionality specify an ODE model and
generate executable C++ simulation code. The user generally won’t have to
directly call any function from this module as this will be done by
amici.pysb_import.pysb2amici()
,
amici.sbml_import.SbmlImporter.sbml2amici()
and
amici.petab_import.import_model()
.
Classes
|
The ODEExporter class generates AMICI C++ files for ODE model as defined in symbolic expressions. |
|
Defines an Ordinary Differential Equation as set of ModelQuantities. |
|
Template format used in AMICI (see |
Functions Summary
|
Load source file, apply template substitution as provided in templateData and save as targetFile. |
|
Constructs the extern function declaration for a given function |
|
Constructs |
|
Constructs the function declaration for an index function of a given function |
|
Constructs the |
Check whether x is a valid identifier for conditions, parameters, observables. |
|
|
Strips typedef info from a function signature |
A faster implementation of sympy's is_zero_matrix |
|
|
Wrapper around symbolic jacobian with some additional checks that reduce computation time for large matrices |
|
Wrapper around symbolic multiplication with some additional checks that reduce computation time for large matrices |
|
Checks if the values for a symbolic variable is passed in the signature of a function |
Functions
- amici.ode_export.apply_template(source_file, target_file, template_data)[source]
Load source file, apply template substitution as provided in templateData and save as targetFile.
- amici.ode_export.get_function_extern_declaration(fun, name)[source]
Constructs the extern function declaration for a given function
- amici.ode_export.get_model_override_implementation(fun, name, nobody=False)[source]
Constructs
amici::Model::*
override implementation for a given function
- amici.ode_export.get_sunindex_extern_declaration(fun, name, indextype)[source]
Constructs the function declaration for an index function of a given function
- amici.ode_export.get_sunindex_override_implementation(fun, name, indextype, nobody=False)[source]
Constructs the
amici::Model
function implementation for an index function of a given function
- amici.ode_export.is_valid_identifier(x)[source]
Check whether x is a valid identifier for conditions, parameters, observables… . Identifiers may only contain upper and lower case letters, digits and underscores, and must not start with a digit.
- amici.ode_export.smart_is_zero_matrix(x)[source]
A faster implementation of sympy’s is_zero_matrix
Avoids repeated indexer type checks and double iteration to distinguish False/None. Found to be about 100x faster for large matrices.
- Parameters
x (
typing.Union
[sympy.matrices.dense.MutableDenseMatrix
,sympy.matrices.sparse.MutableSparseMatrix
]) – Matrix to check- Return type
- amici.ode_export.smart_jacobian(eq, sym_var)[source]
Wrapper around symbolic jacobian with some additional checks that reduce computation time for large matrices
- Parameters
eq (
sympy.matrices.dense.MutableDenseMatrix
) – equationsym_var (
sympy.matrices.dense.MutableDenseMatrix
) – differentiation variable
- Return type
- Returns
jacobian of eq wrt sym_var
- amici.ode_export.smart_multiply(x, y)[source]
Wrapper around symbolic multiplication with some additional checks that reduce computation time for large matrices
- Parameters
x (
typing.Union
[sympy.matrices.dense.MutableDenseMatrix
,sympy.matrices.sparse.MutableSparseMatrix
]) – educt 1y (
sympy.matrices.dense.MutableDenseMatrix
) – educt 2
- Return type
typing.Union
[sympy.matrices.dense.MutableDenseMatrix
,sympy.matrices.sparse.MutableSparseMatrix
]- Returns
product