Class AbstractSpline

Inheritance Relationships

Derived Type

Class Documentation

class AbstractSpline

AMICI spline base class.

Instances of this class are created upon solver setup and the needed splines are set up (e.g., interpolation of the nodes is performed). Upon call to a spline function, only the evaluation of the spline polynomial is carried out.

Subclassed by amici::HermiteSpline

Public Functions

AbstractSpline() = default

default constructor

AbstractSpline(std::vector<realtype> nodes, std::vector<realtype> node_values, bool equidistant_spacing, bool logarithmic_parametrization)

Common constructor for AbstractSpline instances.

Parameters:
  • nodes – the nodes defining the position at which the value of the spline is known (if equidistant_spacing is true, it must contain only the first and the last node; the other nodes will be automatically inserted, assuming they are uniformly spaced)

  • node_values – the values assumed by the spline at the nodes

  • equidistant_spacing – whether equidistant nodes are to be computed

  • logarithmic_parametrization – if true, the spline interpolation will occur in log-space in order to ensure positivity of the interpolant (which strictly speaking will no longer be a spline)

virtual ~AbstractSpline() = default
virtual void compute_coefficients() = 0

Compute the coefficients for all polynomial segments of this spline.

virtual void compute_coefficients_sensi(int nplist, int spline_offset, gsl::span<realtype> dvaluesdp, gsl::span<realtype> dslopesdp) = 0

Compute the coefficients for all polynomial segments of the derivatives of this spline with respect to the parameters.

Remark

The contents of dvaluesdp and dslopesdp may be modified by this function.

Parameters:
  • nplist – number of parameters

  • spline_offset – offset of this spline inside dvaluesdp and dslopesdp

  • dvaluesdp – derivatives of the spline values with respect to the parameters (for all splines in the model, not just this one)

  • dslopesdp – derivatives of the spline derivatives with respect to the parameters (for all splines in the model, not just this one)

realtype get_value(realtype const t) const

Get the value of this spline at a given point.

Parameters:

t – point at which the spline is to be evaluated

Returns:

value of the spline at t

virtual realtype get_value_scaled(realtype const t) const = 0

Get the value of this spline at a given point in the scale in which interpolation is carried out (e.g., log-scale)

Parameters:

t – point at which the spline is to be evaluated

Returns:

scaled value of the spline at t

realtype get_node_value(int const i) const

Get the value of this spline at a given node.

Parameters:

i – index of the node at which the spline is to be evaluated

Returns:

value of the spline at the i-th node

realtype get_node_value_scaled(int const i) const

Get the value of this spline at a given node in the scale in which interpolation is carried out (e.g., log-scale)

Parameters:

i – index of the node at which the spline is to be evaluated

Returns:

scaled value of the spline at the i-th node

realtype get_sensitivity(realtype const t, int const ip) const

Get the derivative of this spline with respect to a given parameter at a given point.

Parameters:
  • t – point at which the sensitivity is to be evaluated

  • ip – index of the parameter

Returns:

sensitivity of the spline with respect to the ipth parameter at t

realtype get_sensitivity(realtype const t, int const ip, realtype const value) const

Get the derivative of this spline with respect to a given parameter at a given point.

Parameters:
  • t – point at which the sensitivity is to be evaluated

  • ip – index of the parameter

  • value – value of the spline at the given time point. It is used e.g. when interpolation is carried out in log-space. If omitted it will be computed.

Returns:

sensitivity of the spline with respect to the ipth parameter at t

virtual realtype get_sensitivity_scaled(realtype const t, int const ip) const = 0

Get the derivative of this spline with respect to a given parameter at a given point in the scale in which interpolation is carried out (e.g., log-scale)

Parameters:
  • t – point at which the sensitivity is to be evaluated

  • ip – index of the parameter

Returns:

scaled sensitivity of the spline with respect to the ipth parameter at t

virtual void compute_final_value() = 0

Compute the limit value of the spline as the evaluation point tends to positive infinity.

virtual void compute_final_sensitivity(int nplist, int spline_offset, gsl::span<realtype> dspline_valuesdp, gsl::span<realtype> dspline_slopesdp) = 0

Compute the limit of the value of the sensitivity as the evaluation point tends to positive infinity.

Parameters:
  • nplist – number of parameters

  • spline_offset – offset of this spline inside dspline_valuesdp and dspline_slopesdp

  • dspline_valuesdp – derivatives of the spline values with respect to the parameters (for all splines in the model, not just this one)

  • dspline_slopesdp – derivatives of the spline derivatives with respect to the parameters (for all splines in the model, not just this one)

realtype get_final_value() const

Get the limit value of the spline as the evaluation point tends to positive infinity.

Returns:

limit value

realtype get_final_value_scaled() const

Get the limit value of the spline (in the scale in which interpolation is carried out) as the evaluation point tends to positive infinity.

Returns:

limit value

realtype get_final_sensitivity(int const ip) const

Get the limit value of the sensitivity with respect to the given parameter as the evaluation point tends to positive infinity.

Parameters:

ip – parameter index

Returns:

limit value

realtype get_final_sensitivity_scaled(int const ip) const

Get the limit value of the sensitivity with respect to the given parameter (in the scale in which interpolation is carried out) as the evaluation point tends to positive infinity.

Parameters:

ip – parameter index

Returns:

limit value

bool get_equidistant_spacing() const

Whether nodes are uniformly spaced.

Returns:

boolean flag

bool get_logarithmic_parametrization() const

Whether spline interpolation is carried out in log-space.

Returns:

boolean flag

inline int n_nodes() const

The number of interpolation nodes for this spline.

Returns:

number of nodes

Protected Functions

void set_final_value_scaled(realtype finalValue)

Set the limit value of the spline (in the scale in which interpolation is carried out) as the evaluation point tends to positive infinity.

Parameters:

finalValue – final value

void set_final_sensitivity_scaled(std::vector<realtype> finalSensitivity)

Set the limit value of the sensitivity (in the scale in which interpolation is carried out) as the evaluation point tends to positive infinity.

Parameters:

finalSensitivity – final value of the sensitivity for each parameter

Protected Attributes

std::vector<realtype> nodes_

The nodes at which this spline is interpolated.

std::vector<realtype> node_values_

The values the spline assumes at the nodes.

std::vector<realtype> coefficients

Coefficients for each polynomial segment of the spline.

std::vector<realtype> coefficients_extrapolate

Polynomial coefficients for the extrapolating the spline values.

std::vector<realtype> coefficients_sensi

Coefficients for each polynomial segment of the sensitivities with respect to the parameters.

std::vector<realtype> coefficients_extrapolate_sensi

Polynomial coefficients for the extrapolating the sensitivities.