Skip to main content

SigmaTerm

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.

Fields

§ends: Vec<f64>

Interval ends in years, strictly increasing and positive.

§values: Vec<R>

The volatility on each interval, non-negative.

Implementations§

§

impl<R: Scalar> SigmaTerm<R>

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

The volatility in force at time t (years): the piece whose interval holds t, the last beyond the last end.

pub(crate) fn overlapping(&self, s: f64, t: f64) -> Vec<(f64, f64, R)>

The pieces overlapping [s, t], as (from, to, σ) with s ≤ from < to ≤ t — a flat term one piece spanning it all.

pub fn passive(&self) -> SigmaTerm<f64>

The derivative-free projection of the term.

§

impl SigmaTerm<f64>

pub fn lift<R: Scalar>(&self) -> SigmaTerm<R>

The term in mode R — a passive lift, carrying no derivatives.

Trait Implementations§

§

impl<R: Clone + Scalar> Clone for SigmaTerm<R>

§

fn clone(&self) -> SigmaTerm<R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<R: Debug + Scalar> Debug for SigmaTerm<R>

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl<R: PartialEq + Scalar> PartialEq for SigmaTerm<R>

§

fn eq(&self, other: &SigmaTerm<R>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<R: PartialEq + Scalar> StructuralPartialEq for SigmaTerm<R>

Auto Trait Implementations§

§

impl<R> Freeze for SigmaTerm<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for SigmaTerm<R>
where R: RefUnwindSafe,

§

impl<R> Send for SigmaTerm<R>

§

impl<R> Sync for SigmaTerm<R>

§

impl<R> Unpin for SigmaTerm<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for SigmaTerm<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for SigmaTerm<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.