Enum Survival
#[non_exhaustive]pub enum Survival {
FlatHazard(FlatHazard),
Isda(IsdaSurvival),
Piecewise(PiecewiseSurvival),
Shocked(ShockedSurvival),
Scaled(ScaledSurvival),
Density(DensitySurvival),
}Expand description
A stored credit term structure. Passive parameters, no AD state.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
FlatHazard(FlatHazard)
One hazard, all maturities.
Isda(IsdaSurvival)
Piecewise-flat segment hazards — the ISDA bootstrap’s output.
Piecewise(PiecewiseSurvival)
Dated log-survival pillars.
Shocked(ShockedSurvival)
A base under a named parallel hazard shock.
Scaled(ScaledSurvival)
A base under a term structure of hazard multipliers.
Density(DensitySurvival)
A piecewise-linear default density.
Implementations§
§impl Survival
impl Survival
pub fn view<R: Scalar>(&self) -> SurvivalView<'_, R>
pub fn view<R: Scalar>(&self) -> SurvivalView<'_, 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],
) -> SurvivalView<'a, R>
pub(crate) fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> SurvivalView<'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>,
) -> SurvivalView<'_, R>
pub(crate) fn view_seeding<R: Scalar + Seedable>( &self, seed: &mut Option<usize>, ) -> SurvivalView<'_, 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 Survival
impl Survival
pub fn parameters(&self) -> &[f64]
pub fn parameters(&self) -> &[f64]
See Family::parameters.
pub fn parts(&self) -> Vec<&Survival>
pub fn parts(&self) -> Vec<&Survival>
See Family::parts.
pub fn view_with<'a, R: Scalar>(
&'a self,
params: &'a [R],
) -> Result<SurvivalView<'a, R>, CurveError>
pub fn view_with<'a, R: Scalar>( &'a self, params: &'a [R], ) -> Result<SurvivalView<'a, R>, CurveError>
pub fn view_seeded<R: Scalar + Seedable>(
&self,
index: usize,
) -> Result<SurvivalView<'_, R>, CurveError>
pub fn view_seeded<R: Scalar + Seedable>( &self, index: usize, ) -> Result<SurvivalView<'_, 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 Survival))
pub fn for_each_owner<'a>(&'a self, f: &mut dyn FnMut(&'a Survival))
pub fn parameter_owners(&self) -> Vec<&Survival>
pub fn parameter_owners(&self) -> Vec<&Survival>
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 Survival
impl Survival
pub fn pillar_dates(&self) -> &[NaiveDate]
pub fn pillar_dates(&self) -> &[NaiveDate]
The dates the hazard changes at — the pillars a CDS’s protection integral must break its intervals on so that each carries a flat hazard. Empty for a flat hazard.
pub fn day_count(&self) -> DayCountFraction
pub fn day_count(&self) -> DayCountFraction
The day count this curve measures time under — for a shock, its base’s.
Trait Implementations§
§impl Family for Survival
impl Family for Survival
§fn parts(&self) -> Vec<&Survival>
fn parts(&self) -> Vec<&Survival>
A leaf reads none, and a shock’s shift is stated data rather than a curve.
§fn own_refusal(&self) -> Option<&'static str>
fn own_refusal(&self) -> Option<&'static str>
Every credit family implemented so far is linear in its stored hazards
or log-survivals, so this is None throughout. The method exists
because a risk pass must ask, not assume: when a family arrives that
cannot record exact adjoints, the read-back refuses here rather than
each caller remembering to check.
§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<Survival> for PinnedSurvival
impl From<Survival> for PinnedSurvival
§impl Lift for Survival
impl Lift for Survival
§type View<'a, R: Scalar> = SurvivalView<'a, R>
where
Self: 'a
type View<'a, R: Scalar> = SurvivalView<'a, R> where Self: 'a
R, borrowing the storage for 'a.§fn view<R: Scalar>(&self) -> SurvivalView<'_, R>
fn view<R: Scalar>(&self) -> SurvivalView<'_, R>
R.§fn view_with_slice<'a, R: Scalar>(
&'a self,
rest: &mut &'a [R],
) -> SurvivalView<'a, R>
fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> SurvivalView<'a, R>
rest, then its parts take theirs, in
parameter_owners order.