Skip to main content

Inflation

Enum Inflation 

#[non_exhaustive]
pub enum Inflation { Piecewise(PiecewiseInflation), Shocked(ShockedInflation), }
Expand description

A stored inflation term structure. Passive parameters, no AD state.

One variant today. It is an enum rather than the bare struct for the reason D4 gives: a generic view::<R>() is not object-safe, so the set has to be closed for the lift to be a generic method — and a second family then arrives as a variant the compiler makes every caller handle.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Piecewise(PiecewiseInflation)

Dated index-level nodes.

§

Shocked(ShockedInflation)

A base under a named move in its zero inflation rate.

Implementations§

§

impl Inflation

pub fn view<R: Scalar>(&self) -> InflationView<'_, R>

This curve lifted into mode R.

Recursive for a family that reads other curves: lifting one lifts its parts, borrowing throughout. For the passive mode nothing is allocated for the parameters at any depth.

pub(crate) fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> InflationView<'a, R>

One step of a substituted walk: each member takes its own parameters off the front of rest, in parameter_owners order.

pub(crate) fn view_seeding<R: Scalar + Seedable>( &self, seed: &mut Option<usize>, ) -> InflationView<'_, R>

One step of a seeded walk: each member consumes the seed if it falls among its own parameters, and passes it on otherwise.

§

impl Inflation

pub fn parameters(&self) -> &[f64]

pub fn parts(&self) -> Vec<&Inflation>

pub fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<InflationView<'a, R>, CurveError>

See Family::view_with.

§Errors

As the trait method.

pub fn view_seeded<R: Scalar + Seedable>( &self, index: usize, ) -> Result<InflationView<'_, R>, CurveError>

See Family::view_seeded.

§Errors

As the trait method.

pub fn parameter_count(&self) -> usize

pub fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Inflation))

pub fn parameter_owners(&self) -> Vec<&Inflation>

pub fn parameter_labels(&self) -> Vec<ParameterLabel>

pub fn adjoint_refusal(&self) -> Option<&'static str>

§

impl Inflation

pub fn base_date(&self) -> NaiveDate

The date the curve is anchored to — its first node, usually the last published print; for a shock, its base’s.

pub fn day_count(&self) -> DayCountFraction

The day count the curve measures time under — for a shock, its base’s.

pub fn node_dates(&self) -> &[NaiveDate]

The node dates — for a shock, its base’s.

Trait Implementations§

§

impl Clone for Inflation

§

fn clone(&self) -> Inflation

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 Debug for Inflation

§

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

Formats the value using the given formatter. Read more
§

impl Family for Inflation

§

fn parts(&self) -> Vec<&Inflation>

Every inflation family today is a leaf. Stated rather than assumed, so a composite variant is counted, flattened and labelled by the shared walks the moment it reports its base here.

§

fn own_refusal(&self) -> Option<&'static str>

A level interpolation that is not linear in its stored levels would refuse here. Both schemes implemented are, so this is None — but a risk pass asks rather than assuming, which is what makes adding a non-linear scheme a decision someone takes here.

§

fn parameters(&self) -> &[f64]

The free parameters this family owns directly. Read more
§

fn own_labels(&self) -> Vec<ParameterLabel>

The labels for the parameters this family owns directly, in the order parameters reports them.
§

fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<Self::View<'a, R>, CurveError>

This family lifted into mode R over params, in place of its stored ones — the whole of what arming used to be. Read more
§

fn view_seeded<R: Scalar + Seedable>( &self, index: usize, ) -> Result<Self::View<'_, R>, CurveError>

This family lifted into forward mode with parameter index carrying a unit tangent and every other a zero tangent. Read more
§

fn parameter_count(&self) -> usize

Every free parameter reachable from this family, counted once. Read more
§

fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Self))

Visits every parameter-owning family reachable from this one, in parameter_owners order, without collecting them. The lift flattens parameters through this so a market of leaves allocates one vector, not one per curve.
§

fn parameter_owners(&self) -> Vec<&Self>

Every parameter-owning family reachable from this one, depth first, including this one. Read more
§

fn parameter_labels(&self) -> Vec<ParameterLabel>

What each free parameter reachable from this family is, in the same order view_with consumes them. Read more
§

fn adjoint_refusal(&self) -> Option<&'static str>

Why this family cannot report correct parameter sensitivities, if it cannot. Read more
§

impl From<Inflation> for PinnedInflation

§

fn from(curve: Inflation) -> Self

Converts to this type from the input type.
§

impl Lift for Inflation

§

type View<'a, R: Scalar> = InflationView<'a, R> where Self: 'a

This family lifted into mode R, borrowing the storage for 'a.
§

fn view<R: Scalar>(&self) -> InflationView<'_, R>

This family lifted into mode R.
§

fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> InflationView<'a, R>

One step of a substituted walk: this family takes its own parameters off the front of rest, then its parts take theirs, in parameter_owners order.
§

fn view_seeding<R: Scalar + Seedable>( &self, seed: &mut Option<usize>, ) -> InflationView<'_, R>

One step of a seeded walk: this family consumes the seed if it falls among its own parameters, and passes it on to its parts otherwise.
§

impl PartialEq for Inflation

§

fn eq(&self, other: &Inflation) -> 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 StructuralPartialEq for Inflation

Auto Trait Implementations§

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.