Class CubicSpline

Inheritance Relationships

Base Types

Class Documentation

class CubicSpline : public otyca::VolatilitySmile, 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(double t = NAN)

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 override

Get the model’s name.

Returns:

A string representing the name of the model.

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

set the transformed parameters for calibration.

Parameters:

transformed_calibration_parameters – the transformed calibration parameters

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

Set the model’s raw parameters.

Parameters:

parameters – A vector of new parameter values.

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

get the transformed parameters for calibration.

Returns:

the transformed parameters for calibration

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

Get the model’s raw parameters.

Returns:

A vector containing the model’s parameters.

std::vector<double> evaluate(const std::vector<std::array<double, 1>> &x) const override
inline virtual std::ostream &print(std::ostream &out) const

Print model parameters and names to an output stream.

Prints parameter names followed by values, comma-separated.

Parameters:

out – The output stream to write to.

Returns:

The modified 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 CalibrationInput &ci) 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)
void calibrate(const Model<1>::CalibrationInput &input, const CalibrationConfig &calibration_config) override