Enum SigmaTerm
pub enum SigmaTerm<R: Scalar> {
Flat(R),
Pieces {
ends: Vec<f64>,
values: Vec<R>,
},
}Expand description
A Hull-White volatility: one flat value, or a piecewise-constant term.
Piece k covers (ends[k−1], ends[k]] in years from the valuation date
(Act/365F, the metric the affine bond and the lattice share), with
ends[−1] = 0; the last value extends flat beyond the last end. A flat
volatility is kept as its own arm so the constant model’s formulas run
unchanged — bit for bit — and resolving it allocates nothing.
Variants§
Flat(R)
One volatility for all time.
Pieces
Strictly increasing positive interval ends, one value per interval.
Implementations§
§impl<R: Scalar> SigmaTerm<R>
impl<R: Scalar> SigmaTerm<R>
pub fn pieces(ends: Vec<f64>, values: Vec<R>) -> Result<Self, CurveError>
pub fn pieces(ends: Vec<f64>, values: Vec<R>) -> Result<Self, CurveError>
A piecewise term over ends (years) with one value each.
§Errors
CurveError::Malformed for no pieces, mismatched lengths, ends that
are not finite, positive and strictly increasing, or a value that is
not finite and non-negative.
pub fn value_at(&self, t: f64) -> R
pub fn value_at(&self, t: f64) -> R
The volatility in force at time t (years): the piece whose interval
holds t, the last beyond the last end.