Enum Precision

Source
pub enum Precision<T> {
    Exact(T),
    Inexact(T),
}
Expand description

A statistic has a precision Exact or Inexact. This represents uncertainty in that value. Exact values are computed, where can inexact values are likely inferred from compute functions.

Inexact statistics form a range of possible values that the statistic could be. This is statistic specific, for max this will be an upper bound. Meaning that the actual max in an array is guaranteed to be less than or equal to the inexact value, but equal to the exact value.

Variants§

§

Exact(T)

§

Inexact(T)

Implementations§

Source§

impl<T> Precision<Option<T>>

Source

pub fn transpose(self) -> Option<Precision<T>>

Transpose the Option<Precision<T>> into Option<Precision<T>>.

Source§

impl<T> Precision<T>
where T: Copy,

Source

pub fn to_inexact(&self) -> Self

Source§

impl<T> Precision<T>

Source

pub fn exact<S: Into<T>>(s: S) -> Precision<T>

Creates an exact value

Source

pub fn inexact<S: Into<T>>(s: S) -> Precision<T>

Creates an inexact value

Source

pub fn as_ref(&self) -> Precision<&T>

Pushed the ref into the Precision enum

Source

pub fn into_inexact(self) -> Self

Converts self into an inexact bound

Source

pub fn as_exact(self) -> Option<T>

Returns the exact value from the bound, if that value is inexact, otherwise None.

Source

pub fn as_inexact(self) -> Option<T>

Returns the exact value from the bound, if that value is inexact, otherwise None.

Source

pub fn is_exact(&self) -> bool

True iff self == Exact(_)

Source

pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Precision<U>

Map the value of either precision value

Source

pub fn zip<U>(self, other: Precision<U>) -> Precision<(T, U)>

Zip two Precision values into a tuple, keeping the inexactness if any.

Source

pub fn try_map<U, F: FnOnce(T) -> VortexResult<U>>( self, f: F, ) -> VortexResult<Precision<U>>

Similar to map but handles fucntions that can fail.

Source§

impl Precision<ScalarValue>

Source

pub fn into_scalar(self, dtype: DType) -> Precision<Scalar>

Source§

impl Precision<&ScalarValue>

Source

pub fn into_scalar(self, dtype: DType) -> Precision<Scalar>

Source§

impl<T> Precision<T>

This allows a stat with a Precision to be interpreted as a bound.

Source

pub fn bound<S: StatType<T>>(self) -> S::Bound

Applied the stat associated bound to the precision value

Trait Implementations§

Source§

impl<T> Clone for Precision<T>
where T: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Precision<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Display> Display for Precision<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq> PartialEq<T> for Precision<T>

Source§

fn eq(&self, other: &T) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
Source§

impl<T: PartialEq> PartialEq for Precision<T>

Source§

fn eq(&self, other: &Precision<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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.
Source§

impl<T: PartialOrd + Clone> StatBound<T> for Precision<T>

Source§

fn lift(value: Precision<T>) -> Self

Creates a new bound from a Precision statistic.
Source§

fn union(&self, other: &Self) -> Option<Self>

Finds the smallest bound that covers both bounds. A.k.a. the meet of the bound.
Source§

fn intersection(&self, other: &Self) -> Option<IntersectionResult<Self>>

Refines the bounds to the most precise estimate we can make for that bound. If the bounds are disjoint, then the result is None. e.g. Precision::Inexact(5) and Precision::Exact(6) would result in Precision::Inexact(5). A.k.a. the join of the bound.
Source§

fn to_exact(&self) -> Option<&T>

Returns the exact value from the bound if that value is exact, otherwise None.
Source§

fn into_value(self) -> Precision<T>

Converts Self back to Precision<T>, inverse of lift.
Source§

impl<T: Eq> Eq for Precision<T>

Source§

impl<T> StructuralPartialEq for Precision<T>

Auto Trait Implementations§

§

impl<T> Freeze for Precision<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Precision<T>
where T: RefUnwindSafe,

§

impl<T> Send for Precision<T>
where T: Send,

§

impl<T> Sync for Precision<T>
where T: Sync,

§

impl<T> Unpin for Precision<T>
where T: Unpin,

§

impl<T> UnwindSafe for Precision<T>
where T: UnwindSafe,

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T