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
Piecewise(PiecewiseInflation)
Dated index-level nodes.
Shocked(ShockedInflation)
A base under a named move in its zero inflation rate.
Implementations§
§impl Inflation
impl Inflation
pub fn view<R: Scalar>(&self) -> InflationView<'_, R>
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>
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>
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
impl Inflation
pub fn parameters(&self) -> &[f64]
pub fn parameters(&self) -> &[f64]
See Family::parameters.
pub fn parts(&self) -> Vec<&Inflation>
pub fn parts(&self) -> Vec<&Inflation>
See Family::parts.
pub fn view_with<'a, R: Scalar>(
&'a self,
params: &'a [R],
) -> Result<InflationView<'a, R>, CurveError>
pub fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<InflationView<'a, R>, CurveError>
pub fn view_seeded<R: Scalar + Seedable>(
&self,
index: usize,
) -> Result<InflationView<'_, R>, CurveError>
pub fn view_seeded<R: Scalar + Seedable>( &self, index: usize, ) -> Result<InflationView<'_, R>, CurveError>
pub fn parameter_count(&self) -> usize
pub fn parameter_count(&self) -> usize
pub fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Inflation))
pub fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Inflation))
pub fn parameter_owners(&self) -> Vec<&Inflation>
pub fn parameter_owners(&self) -> Vec<&Inflation>
pub fn parameter_labels(&self) -> Vec<ParameterLabel>
pub fn parameter_labels(&self) -> Vec<ParameterLabel>
pub fn adjoint_refusal(&self) -> Option<&'static str>
pub fn adjoint_refusal(&self) -> Option<&'static str>
§impl Inflation
impl Inflation
pub fn base_date(&self) -> NaiveDate
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
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]
pub fn node_dates(&self) -> &[NaiveDate]
The node dates — for a shock, its base’s.
Trait Implementations§
§impl Family for Inflation
impl Family for Inflation
§fn parts(&self) -> Vec<&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>
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]
fn parameters(&self) -> &[f64]
§fn own_labels(&self) -> Vec<ParameterLabel>
fn own_labels(&self) -> Vec<ParameterLabel>
parameters reports them.§fn view_with<'a, R: Scalar>(
&'a self,
params: &'a [R],
) -> Result<Self::View<'a, R>, CurveError>
fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<Self::View<'a, R>, CurveError>
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>
fn view_seeded<R: Scalar + Seedable>( &self, index: usize, ) -> Result<Self::View<'_, R>, CurveError>
index carrying a
unit tangent and every other a zero tangent. Read more§fn parameter_count(&self) -> usize
fn parameter_count(&self) -> usize
§fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Self))
fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Self))
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>
fn parameter_owners(&self) -> Vec<&Self>
§fn parameter_labels(&self) -> Vec<ParameterLabel>
fn parameter_labels(&self) -> Vec<ParameterLabel>
§fn adjoint_refusal(&self) -> Option<&'static str>
fn adjoint_refusal(&self) -> Option<&'static str>
§impl From<Inflation> for PinnedInflation
impl From<Inflation> for PinnedInflation
§impl Lift for Inflation
impl Lift for Inflation
§type View<'a, R: Scalar> = InflationView<'a, R>
where
Self: 'a
type View<'a, R: Scalar> = InflationView<'a, R> where Self: 'a
R, borrowing the storage for 'a.§fn view<R: Scalar>(&self) -> InflationView<'_, R>
fn view<R: Scalar>(&self) -> InflationView<'_, R>
R.§fn view_with_slice<'a, R: Scalar>(
&'a self,
rest: &mut &'a [R],
) -> InflationView<'a, R>
fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> InflationView<'a, R>
rest, then its parts take theirs, in
parameter_owners order.