Class HermiteSpline

Inheritance Relationships

Base Type

Class Documentation

class HermiteSpline : public amici::AbstractSpline

AMICI Hermite spline class.

Instances of this class represent Hermite splines, which are uniquely determined by their nodes, the values at their nodes, the derivatives at their nodes (defaulting to finite difference approximations from the node values), boundary conditions and extrapolation conditions. Optionally, the spline can be defined in log-space in order to ensure positivity.

Public Functions

HermiteSpline() = default
HermiteSpline(std::vector<realtype> nodes, std::vector<realtype> node_values, std::vector<realtype> node_values_derivative, SplineBoundaryCondition firstNodeBC, SplineBoundaryCondition lastNodeBC, SplineExtrapolation firstNodeExtrapol, SplineExtrapolation lastNodeExtrapol, bool node_derivative_by_FD, bool equidistant_spacing, bool logarithmic_parametrization)

Construct a HermiteSpline.

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

  • node_values_derivative – the derivatives of the spline at the nodes (if node_derivative_by_FD is true, it will resized and filled with finite difference approximations computed from node_values)

  • firstNodeBC – boundary condition at the first node

  • lastNodeBC – boundary condition at the last node

  • firstNodeExtrapol – extrapolation method on the left side

  • lastNodeExtrapol – extrapolation method on the right side

  • node_derivative_by_FD – whether derivatives are to be computed by finite differences

  • 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 void compute_coefficients() override

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) override

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)

virtual void compute_final_value() override

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) override

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)

virtual realtype get_value_scaled(realtype const t) const override

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_derivative(int const i) const

Get the derivative of the spline at a given node.

Parameters:

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

Returns:

value of the derivative at the i-th node

realtype get_node_derivative_scaled(int const i) const

Get the derivative of the 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 derivative at the i-th node

virtual realtype get_sensitivity_scaled(realtype const t, int const ip) const override

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

inline bool get_node_derivative_by_fd() const

Whether derivatives of this spline are computed by finite differences.

Returns:

boolean flag