Class AbstractModel¶
Defined in File abstract_model.h
Inheritance Relationships¶
Derived Type¶
public amici::Model
(Class Model)
Class Documentation¶
-
class
amici
::
AbstractModel
¶ Abstract base class of amici::Model defining functions that need to be implemented in an AMICI model.
Some functions have empty default implementations or throw. This class shall not have any data members.
Subclassed by amici::Model
Public Functions
-
~AbstractModel
() = default¶
-
void
froot
(const realtype t, const AmiVector &x, const AmiVector &dx, gsl::span<realtype> root) = 0¶ Root function.
- Parameters
t
: timex
: statedx
: time derivative of state (DAE only)root
: array to which values of the root function will be written
-
void
fxdot
(const realtype t, const AmiVector &x, const AmiVector &dx, AmiVector &xdot) = 0¶ Residual function.
- Parameters
t
: timex
: statedx
: time derivative of state (DAE only)xdot
: array to which values of the residual function will be written
-
void
fsxdot
(const realtype t, const AmiVector &x, const AmiVector &dx, int ip, const AmiVector &sx, const AmiVector &sdx, AmiVector &sxdot) = 0¶ Sensitivity Residual function.
- Parameters
t
: timex
: statedx
: time derivative of state (DAE only)ip
: parameter indexsx
: sensitivity statesdx
: time derivative of sensitivity state (DAE only)sxdot
: array to which values of the sensitivity residual function will be written
-
void
fxBdot_ss
(const realtype t, const AmiVector &xB, const AmiVector &dxB, AmiVector &xBdot) = 0¶ Residual function backward when running in steady state mode.
- Parameters
t
: timexB
: adjoint statedxB
: time derivative of state (DAE only)xBdot
: array to which values of the residual function will be written
-
void
fJSparseB_ss
(SUNMatrix JB) = 0¶ Sparse Jacobian function backward, steady state case.
- Parameters
JB
: sparse matrix to which values of the Jacobian will be written
-
void
writeSteadystateJB
(const realtype t, realtype cj, const AmiVector &x, const AmiVector &dx, const AmiVector &xB, const AmiVector &dxB, const AmiVector &xBdot) = 0¶ Computes the sparse backward Jacobian for steadystate integration and writes it to the model member.
- Parameters
t
: timepointcj
: scalar in Jacobianx
: Vector with the statesdx
: Vector with the derivative statesxB
: Vector with the adjoint statesdxB
: Vector with the adjoint derivative statesxBdot
: Vector with the adjoint state right hand side
-
void
fJ
(const realtype t, realtype cj, const AmiVector &x, const AmiVector &dx, const AmiVector &xdot, SUNMatrix J) = 0¶ Dense Jacobian function.
- Parameters
t
: timecj
: scaling factor (inverse of timestep, DAE only)x
: statedx
: time derivative of state (DAE only)xdot
: values of residual function (unused)J
: dense matrix to which values of the jacobian will be written
-
void
fJB
(const realtype t, realtype cj, const AmiVector &x, const AmiVector &dx, const AmiVector &xB, const AmiVector &dxB, const AmiVector &xBdot, SUNMatrix JB) = 0¶ Dense Jacobian function.
- Parameters
t
: timecj
: scaling factor (inverse of timestep, DAE only)x
: statedx
: time derivative of state (DAE only)xB
: Vector with the adjoint statesdxB
: Vector with the adjoint derivative statesxBdot
: Vector with the adjoint right hand side (unused)JB
: dense matrix to which values of the jacobian will be written
-
void
fJSparse
(const realtype t, realtype cj, const AmiVector &x, const AmiVector &dx, const AmiVector &xdot, SUNMatrix J) = 0¶ Sparse Jacobian function.
- Parameters
t
: timecj
: scaling factor (inverse of timestep, DAE only)x
: statedx
: time derivative of state (DAE only)xdot
: values of residual function (unused)J
: sparse matrix to which values of the Jacobian will be written
-
void
fJSparseB
(const realtype t, realtype cj, const AmiVector &x, const AmiVector &dx, const AmiVector &xB, const AmiVector &dxB, const AmiVector &xBdot, SUNMatrix JB) = 0¶ Sparse Jacobian function.
- Parameters
t
: timecj
: scaling factor (inverse of timestep, DAE only)x
: statedx
: time derivative of state (DAE only)xB
: Vector with the adjoint statesdxB
: Vector with the adjoint derivative statesxBdot
: Vector with the adjoint right hand side (unused)JB
: dense matrix to which values of the jacobian will be written
-
void
fJDiag
(const realtype t, AmiVector &Jdiag, realtype cj, const AmiVector &x, const AmiVector &dx) = 0¶ Diagonal Jacobian function.
- Parameters
t
: timeJdiag
: array to which the diagonal of the Jacobian will be writtencj
: scaling factor (inverse of timestep, DAE only)x
: statedx
: time derivative of state (DAE only)
-
void
fdxdotdp
(const realtype t, const AmiVector &x, const AmiVector &dx) = 0¶ Model-specific sparse implementation of explicit parameter derivative of right hand side.
- Parameters
t
: timex
: statedx
: time derivative of state (DAE only)
-
void
fJv
(const realtype t, const AmiVector &x, const AmiVector &dx, const AmiVector &xdot, const AmiVector &v, AmiVector &nJv, realtype cj) = 0¶ Jacobian multiply function.
- Parameters
t
: timex
: statedx
: time derivative of state (DAE only)xdot
: values of residual function (unused)v
: multiplication vector (unused)nJv
: array to which result of multiplication will be writtencj
: scaling factor (inverse of timestep, DAE only)
-
std::string
getAmiciVersion
() const¶ Returns the AMICI version that was used to generate the model.
- Return
AMICI version string
-
std::string
getAmiciCommit
() const¶ Returns the AMICI commit that was used to generate the model.
- Return
AMICI commit string
-
void
fx0
(realtype *x0, const realtype t, const realtype *p, const realtype *k)¶ Model-specific implementation of fx0.
- Parameters
x0
: initial statet
: initial timep
: parameter vectork
: constant vector
-
bool
isFixedParameterStateReinitializationAllowed
() const¶ Function indicating whether reinitialization of states depending on fixed parameters is permissible.
- Return
flag indicating whether reinitialization of states depending on fixed parameters is permissible
-
void
fx0_fixedParameters
(realtype *x0, const realtype t, const realtype *p, const realtype *k, gsl::span<const int> reinitialization_state_idxs)¶ Model-specific implementation of fx0_fixedParameters.
- Parameters
x0
: initial statet
: initial timep
: parameter vectork
: constant vectorreinitialization_state_idxs
: Indices of states to be reinitialized based on provided constants / fixed parameters.
-
void
fsx0_fixedParameters
(realtype *sx0, const realtype t, const realtype *x0, const realtype *p, const realtype *k, int ip, gsl::span<const int> reinitialization_state_idxs)¶ Model-specific implementation of fsx0_fixedParameters.
- Parameters
sx0
: initial state sensitivitiest
: initial timex0
: initial statep
: parameter vectork
: constant vectorip
: sensitivity indexreinitialization_state_idxs
: Indices of states to be reinitialized based on provided constants / fixed parameters.
-
void
fsx0
(realtype *sx0, const realtype t, const realtype *x0, const realtype *p, const realtype *k, int ip)¶ Model-specific implementation of fsx0.
- Parameters
sx0
: initial state sensitivitiest
: initial timex0
: initial statep
: parameter vectork
: constant vectorip
: sensitivity index
-
void
fdx0
(AmiVector &x0, AmiVector &dx0)¶ Initial value for time derivative of states (only necessary for DAEs)
- Parameters
x0
: Vector with the initial statesdx0
: Vector to which the initial derivative states will be written (only DAE)
-
void
fstau
(realtype *stau, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *sx, int ip, int ie)¶ Model-specific implementation of fstau.
- Parameters
stau
: total derivative of event timepointt
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorsx
: current state sensitivityip
: sensitivity indexie
: event index
-
void
fy
(realtype *y, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w)¶ Model-specific implementation of fy.
- Parameters
y
: model output at current timepointt
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorw
: repeating elements vector
-
void
fdydp
(realtype *dydp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, int ip, const realtype *w, const realtype *dwdp)¶ Model-specific implementation of fdydp.
- Parameters
dydp
: partial derivative of observables y w.r.t. model parameters pt
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorip
: parameter index w.r.t. which the derivative is requestedw
: repeating elements vectordwdp
: Recurring terms in xdot, parameter derivative
-
void
fdydx
(realtype *dydx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx)¶ Model-specific implementation of fdydx.
- Parameters
dydx
: partial derivative of observables y w.r.t. model states xt
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorw
: repeating elements vectordwdx
: Recurring terms in xdot, state derivative
-
void
fz
(realtype *z, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h)¶ Model-specific implementation of fz.
- Parameters
z
: value of event outputie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vector
-
void
fsz
(realtype *sz, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *sx, int ip)¶ Model-specific implementation of fsz.
- Parameters
sz
: Sensitivity of rz, total derivativeie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorsx
: current state sensitivityip
: sensitivity index
-
void
frz
(realtype *rz, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h)¶ Model-specific implementation of frz.
- Parameters
rz
: value of root function at current timepoint (non-output events not included)ie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vector
-
void
fsrz
(realtype *srz, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *sx, int ip)¶ Model-specific implementation of fsrz.
- Parameters
srz
: Sensitivity of rz, total derivativeie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorsx
: current state sensitivityh
: Heaviside vectorip
: sensitivity index
-
void
fdzdp
(realtype *dzdp, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, int ip)¶ Model-specific implementation of fdzdp.
- Parameters
dzdp
: partial derivative of event-resolved output z w.r.t. model parameters pie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorip
: parameter index w.r.t. which the derivative is requested
-
void
fdzdx
(realtype *dzdx, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h)¶ Model-specific implementation of fdzdx.
- Parameters
dzdx
: partial derivative of event-resolved output z w.r.t. model states xie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vector
-
void
fdrzdp
(realtype *drzdp, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, int ip)¶ Model-specific implementation of fdrzdp.
- Parameters
drzdp
: partial derivative of root output rz w.r.t. model parameters pie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorip
: parameter index w.r.t. which the derivative is requested
-
void
fdrzdx
(realtype *drzdx, int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h)¶ Model-specific implementation of fdrzdx.
- Parameters
drzdx
: partial derivative of root output rz w.r.t. model states xie
: event indext
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vector
-
void
fdeltax
(realtype *deltax, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, int ie, const realtype *xdot, const realtype *xdot_old)¶ Model-specific implementation of fdeltax.
- Parameters
deltax
: state updatet
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorie
: event indexxdot
: new model right hand sidexdot_old
: previous model right hand side
-
void
fdeltasx
(realtype *deltasx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, int ip, int ie, const realtype *xdot, const realtype *xdot_old, const realtype *sx, const realtype *stau)¶ Model-specific implementation of fdeltasx.
- Parameters
deltasx
: sensitivity updatet
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorw
: repeating elements vectorip
: sensitivity indexie
: event indexxdot
: new model right hand sidexdot_old
: previous model right hand sidesx
: state sensitivitystau
: event-time sensitivity
-
void
fdeltaxB
(realtype *deltaxB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, int ie, const realtype *xdot, const realtype *xdot_old, const realtype *xB)¶ Model-specific implementation of fdeltaxB.
- Parameters
deltaxB
: adjoint state updatet
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorie
: event indexxdot
: new model right hand sidexdot_old
: previous model right hand sidexB
: current adjoint state
-
void
fdeltaqB
(realtype *deltaqB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, int ip, int ie, const realtype *xdot, const realtype *xdot_old, const realtype *xB)¶ Model-specific implementation of fdeltaqB.
- Parameters
deltaqB
: sensitivity updatet
: current timex
: current statep
: parameter vectork
: constant vectorh
: Heaviside vectorip
: sensitivity indexie
: event indexxdot
: new model right hand sidexdot_old
: previous model right hand sidexB
: adjoint state
-
void
fsigmay
(realtype *sigmay, const realtype t, const realtype *p, const realtype *k)¶ Model-specific implementation of fsigmay.
- Parameters
sigmay
: standard deviation of measurementst
: current timep
: parameter vectork
: constant vector
-
void
fdsigmaydp
(realtype *dsigmaydp, const realtype t, const realtype *p, const realtype *k, int ip)¶ Model-specific implementation of fsigmay.
- Parameters
dsigmaydp
: partial derivative of standard deviation of measurementst
: current timep
: parameter vectork
: constant vectorip
: sensitivity index
-
void
fsigmaz
(realtype *sigmaz, const realtype t, const realtype *p, const realtype *k)¶ Model-specific implementation of fsigmaz.
- Parameters
sigmaz
: standard deviation of event measurementst
: current timep
: parameter vectork
: constant vector
-
void
fdsigmazdp
(realtype *dsigmazdp, const realtype t, const realtype *p, const realtype *k, int ip)¶ Model-specific implementation of fsigmaz.
- Parameters
dsigmazdp
: partial derivative of standard deviation of event measurementst
: current timep
: parameter vectork
: constant vectorip
: sensitivity index
-
void
fJy
(realtype *nllh, int iy, const realtype *p, const realtype *k, const realtype *y, const realtype *sigmay, const realtype *my)¶ Model-specific implementation of fJy.
- Parameters
nllh
: negative log-likelihood for measurements yiy
: output indexp
: parameter vectork
: constant vectory
: model output at timepointsigmay
: measurement standard deviation at timepointmy
: measurements at timepoint
-
void
fJz
(realtype *nllh, int iz, const realtype *p, const realtype *k, const realtype *z, const realtype *sigmaz, const realtype *mz)¶ Model-specific implementation of fJz.
- Parameters
nllh
: negative log-likelihood for event measurements ziz
: event output indexp
: parameter vectork
: constant vectorz
: model event output at timepointsigmaz
: event measurement standard deviation at timepointmz
: event measurements at timepoint
-
void
fJrz
(realtype *nllh, int iz, const realtype *p, const realtype *k, const realtype *z, const realtype *sigmaz)¶ Model-specific implementation of fJrz.
- Parameters
nllh
: regularization for event measurements ziz
: event output indexp
: parameter vectork
: constant vectorz
: model event output at timepointsigmaz
: event measurement standard deviation at timepoint
-
void
fdJydy
(realtype *dJydy, int iy, const realtype *p, const realtype *k, const realtype *y, const realtype *sigmay, const realtype *my)¶ Model-specific implementation of fdJydy.
- Parameters
dJydy
: partial derivative of time-resolved measurement negative log-likelihood Jyiy
: output indexp
: parameter vectork
: constant vectory
: model output at timepointsigmay
: measurement standard deviation at timepointmy
: measurement at timepoint
-
void
fdJydy_colptrs
(SUNMatrixWrapper &dJydy, int index)¶ Model-specific implementation of fdJydy colptrs.
- Parameters
dJydy
: sparse matrix to which colptrs will be writtenindex
: ytrue index
-
void
fdJydy_rowvals
(SUNMatrixWrapper &dJydy, int index)¶ Model-specific implementation of fdJydy rowvals.
- Parameters
dJydy
: sparse matrix to which rowvals will be writtenindex
:ytrue
index
-
void
fdJydsigma
(realtype *dJydsigma, int iy, const realtype *p, const realtype *k, const realtype *y, const realtype *sigmay, const realtype *my)¶ Model-specific implementation of fdJydsigma.
- Parameters
dJydsigma
: Sensitivity of time-resolved measurement negative log-likelihood Jy w.r.t. standard deviation sigmayiy
: output indexp
: parameter vectork
: constant vectory
: model output at timepointsigmay
: measurement standard deviation at timepointmy
: measurement at timepoint
-
void
fdJzdz
(realtype *dJzdz, int iz, const realtype *p, const realtype *k, const realtype *z, const realtype *sigmaz, const realtype *mz)¶ Model-specific implementation of fdJzdz.
- Parameters
dJzdz
: partial derivative of event measurement negative log-likelihood Jziz
: event output indexp
: parameter vectork
: constant vectorz
: model event output at timepointsigmaz
: event measurement standard deviation at timepointmz
: event measurement at timepoint
-
void
fdJzdsigma
(realtype *dJzdsigma, int iz, const realtype *p, const realtype *k, const realtype *z, const realtype *sigmaz, const realtype *mz)¶ Model-specific implementation of fdJzdsigma.
- Parameters
dJzdsigma
: Sensitivity of event measurement negative log-likelihood Jz w.r.t. standard deviation sigmaziz
: event output indexp
: parameter vectork
: constant vectorz
: model event output at timepointsigmaz
: event measurement standard deviation at timepointmz
: event measurement at timepoint
-
void
fdJrzdz
(realtype *dJrzdz, int iz, const realtype *p, const realtype *k, const realtype *rz, const realtype *sigmaz)¶ Model-specific implementation of fdJrzdz.
- Parameters
dJrzdz
: partial derivative of event penalization Jrziz
: event output indexp
: parameter vectork
: constant vectorrz
: model root output at timepointsigmaz
: event measurement standard deviation at timepoint
-
void
fdJrzdsigma
(realtype *dJrzdsigma, int iz, const realtype *p, const realtype *k, const realtype *rz, const realtype *sigmaz)¶ Model-specific implementation of fdJrzdsigma.
- Parameters
dJrzdsigma
: Sensitivity of event penalization Jrz w.r.t. standard deviation sigmaziz
: event output indexp
: parameter vectork
: constant vectorrz
: model root output at timepointsigmaz
: event measurement standard deviation at timepoint
-
void
fw
(realtype *w, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *tcl)¶ Model-specific implementation of fw.
- Parameters
w
: Recurring terms in xdott
: timepointx
: vector with the statesp
: parameter vectork
: constants vectorh
: Heaviside vectortcl
: total abundances for conservation laws
-
void
fdwdp
(realtype *dwdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *tcl, const realtype *stcl)¶ Model-specific sparse implementation of dwdp.
- Parameters
dwdp
: Recurring terms in xdot, parameter derivativet
: timepointx
: vector with the statesp
: parameter vectork
: constants vectorh
: Heaviside vectorw
: vector with helper variablestcl
: total abundances for conservation lawsstcl
: sensitivities of total abundances for conservation laws
-
void
fdwdp_colptrs
(SUNMatrixWrapper &dwdp)¶ Model-specific implementation for dwdp, column pointers.
- Parameters
dwdp
: sparse matrix to which colptrs will be written
-
void
fdwdp_rowvals
(SUNMatrixWrapper &dwdp)¶ Model-specific implementation for dwdp, row values.
- Parameters
dwdp
: sparse matrix to which rowvals will be written
-
void
fdwdp
(realtype *dwdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *tcl, const realtype *stcl, int ip)¶ Model-specific sensitivity implementation of dwdp.
- Parameters
dwdp
: Recurring terms in xdot, parameter derivativet
: timepointx
: vector with the statesp
: parameter vectork
: constants vectorh
: Heaviside vectorw
: vector with helper variablestcl
: total abundances for conservation lawsstcl
: sensitivities of total abundances for conservation lawsip
: sensitivity parameter index
-
void
fdwdx
(realtype *dwdx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *tcl)¶ Model-specific implementation of dwdx, data part.
- Parameters
dwdx
: Recurring terms in xdot, state derivativet
: timepointx
: vector with the statesp
: parameter vectork
: constants vectorh
: Heaviside vectorw
: vector with helper variablestcl
: total abundances for conservation laws
-
void
fdwdx_colptrs
(SUNMatrixWrapper &dwdx)¶ Model-specific implementation for dwdx, column pointers.
- Parameters
dwdx
: sparse matrix to which colptrs will be written
-
void
fdwdx_rowvals
(SUNMatrixWrapper &dwdx)¶ Model-specific implementation for dwdx, row values.
- Parameters
dwdx
: sparse matrix to which rowvals will be written
-
void
fdwdw
(realtype *dwdw, realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *tcl)¶ Model-specific implementation of fdwdw, no w chainrule (Py)
- Parameters
dwdw
: partial derivative w wrt wt
: timepointx
: Vector with the statesp
: parameter vectork
: constants vectorh
: Heaviside vectorw
: vector with helper variablestcl
: Total abundances for conservation laws
-
void
fdwdw_colptrs
(SUNMatrixWrapper &dwdw)¶ Model-specific implementation of fdwdw, colptrs part.
- Parameters
dwdw
: sparse matrix to which colptrs will be written
-
void
fdwdw_rowvals
(SUNMatrixWrapper &dwdw)¶ Model-specific implementation of fdwdw, rowvals part.
- Parameters
dwdw
: sparse matrix to which rowvals will be written
-