Struct opendp::core::StabilityRelation [−][src]
pub struct StabilityRelation<MI: Metric, MO: Metric> { pub relation: Rc<dyn Fn(&MI::Distance, &MO::Distance) -> Fallible<bool>>, pub forward_map: Option<Rc<dyn Fn(&MI::Distance) -> Fallible<Box<MO::Distance>>>>, pub backward_map: Option<Rc<dyn Fn(&MO::Distance) -> Fallible<Box<MI::Distance>>>>, }
Expand description
A boolean relation evaluating the stability of a Transformation
.
A StabilityRelation
is implemented as a function that takes an input and output Metric::Distance
,
and returns a boolean indicating if the relation holds.
Fields
relation: Rc<dyn Fn(&MI::Distance, &MO::Distance) -> Fallible<bool>>
forward_map: Option<Rc<dyn Fn(&MI::Distance) -> Fallible<Box<MO::Distance>>>>
backward_map: Option<Rc<dyn Fn(&MO::Distance) -> Fallible<Box<MI::Distance>>>>
Implementations
pub fn new_fallible(
relation: impl Fn(&MI::Distance, &MO::Distance) -> Fallible<bool> + 'static
) -> Self
pub fn new_all(
relation: impl Fn(&MI::Distance, &MO::Distance) -> Fallible<bool> + 'static,
forward_map: Option<impl Fn(&MI::Distance) -> Fallible<Box<MO::Distance>> + 'static>,
backward_map: Option<impl Fn(&MO::Distance) -> Fallible<Box<MI::Distance>> + 'static>
) -> Self
pub fn new_from_constant(c: MO::Distance) -> Self where
MI::Distance: InfCast<MO::Distance> + Clone,
MO::Distance: DistanceConstant<MI::Distance>,
pub fn make_chain<MX: 'static + Metric>(
relation1: &StabilityRelation<MX, MO>,
relation0: &StabilityRelation<MI, MX>,
hint: Option<&HintTt<MI, MO, MX>>
) -> Self
Trait Implementations
Auto Trait Implementations
impl<MI, MO> !RefUnwindSafe for StabilityRelation<MI, MO>
impl<MI, MO> !Send for StabilityRelation<MI, MO>
impl<MI, MO> !Sync for StabilityRelation<MI, MO>
impl<MI, MO> Unpin for StabilityRelation<MI, MO>
impl<MI, MO> !UnwindSafe for StabilityRelation<MI, MO>
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
type Output = T
type Output = T
Should always be Self
Casts the value.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub unsafe fn to_subset_unchecked(&self) -> SS
pub unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
Casts the value.
pub fn vzip(self) -> V
Casts the value.