Struct opendp::metrics::LpDistance
source · pub struct LpDistance<const P: usize, Q>(PhantomData<Q>);
Expand description
The $L_p$ distance between two vector-valued aggregates.
Proof Definition
$d$-closeness
For any two vectors $u, v \in \texttt{D}$ and $d$ of generic type $\texttt{Q}$, we say that $u, v$ are $d$-close under the the $L_p$ distance metric (abbreviated as $d_{LP}$) whenever
d_{LP}(u, v) = \|u_i - v_i\|_p \leq d
If $u$ and $v$ are different lengths, then
d_{LP}(u, v) = \infty
Compatible Domains
VectorDomain<D>
for any validD
MapDomain<D>
for any validD
Tuple Fields§
§0: PhantomData<Q>
Trait Implementations§
source§impl<const P: usize, Q> Clone for LpDistance<P, Q>
impl<const P: usize, Q> Clone for LpDistance<P, Q>
source§impl<const P: usize, Q> Debug for LpDistance<P, Q>
impl<const P: usize, Q> Debug for LpDistance<P, Q>
source§impl<const P: usize, Q> Default for LpDistance<P, Q>
impl<const P: usize, Q> Default for LpDistance<P, Q>
source§impl<const P: usize, Q> Metric for LpDistance<P, Q>
impl<const P: usize, Q> Metric for LpDistance<P, Q>
source§impl<const P: usize, Q> PartialEq<LpDistance<P, Q>> for LpDistance<P, Q>
impl<const P: usize, Q> PartialEq<LpDistance<P, Q>> for LpDistance<P, Q>
impl<const P: usize, T> BAryTreeMetric for LpDistance<P, T>
impl<const P: usize, Q> LipschitzMulFloatMetric for LpDistance<P, Q>
Auto Trait Implementations§
impl<const P: usize, Q> RefUnwindSafe for LpDistance<P, Q>where Q: RefUnwindSafe,
impl<const P: usize, Q> Send for LpDistance<P, Q>where Q: Send,
impl<const P: usize, Q> Sync for LpDistance<P, Q>where Q: Sync,
impl<const P: usize, Q> Unpin for LpDistance<P, Q>where Q: Unpin,
impl<const P: usize, Q> UnwindSafe for LpDistance<P, Q>where Q: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.