Class CubicSpline

Inheritance Relationships

Base Types

Class Documentation

class CubicSpline : public otyca::Model<1>, private otyca::Scatter<double>

A one-dimensional spline model with lazy recalculation support.

Inherits from Model<1> to provide a generic modeling interface and privately from Scatter<double> to reuse scattered data functionality.

Public Functions

CubicSpline()

Constructor for CubicSpline.

void reset()

Clears all internal knots and state.

bool add_knot(double x, double y)

Adds a new knot (x, y) to the spline.

Parameters:
  • x – The x-coordinate of the knot.

  • y – The y-coordinate of the knot.

Returns:

true if the knot was added successfully.

inline virtual std::string name() const

Returns the name of the model.

Returns:

The name “Spline”.

virtual void set_transformed_calibration_parameters(const std::vector<double> &transformed_parameters)

Sets the transformed parameters of the model.

Parameters:

transformed_parameters – A vector of transformed parameter values.

inline virtual void set_parameters(const std::vector<double> &parameters)

Set the model’s raw parameters.

Parameters:

parameters – A vector of new parameter values.

virtual std::vector<double> get_transformed_calibration_parameters() const

Gets the current transformed parameters.

Returns:

A vector of transformed parameters.

virtual std::vector<double> get_parameters() const

Returns internal parameters, optionally for calibration.

Returns:

A vector of parameters.

virtual std::vector<double> evaluate(const std::vector<std::array<double, 1>> &x) const

Evaluate the spline on a vector of input values.

Parameters:

x – Vector of x values.

Returns:

Vector of corresponding y values from the spline.

inline virtual std::ostream &print(std::ostream &out) const

Print the model to an output stream.

Includes both model and scatter data.

Parameters:

out – Output stream.

Returns:

Reference to the same output stream.

inline std::vector<double> get_knot_x()

Gets the current x-coordinates of the spline knots.

Returns:

A vector of x-values.

inline std::vector<double> get_knot_y()

Gets the current y-coordinates of the spline knots.

Returns:

A vector of y-values.

virtual std::vector<double> get_regularizer_penalties() const override
inline void set_wiggle_penalty(double wiggle_penalty)
inline void set_left_wing_penalty(double left_wing_penalty)
inline void set_right_wing_penalty(double right_wing_penalty)
virtual void calibrate(const CalibrationInput &ci, const CalibrationConfig &cc = CalibrationConfig()) override