pub struct TDigest { /* private fields */ }
Expand description
T-Digest to be operated on.
Implementations§
Source§impl TDigest
impl TDigest
Source§impl TDigest
impl TDigest
pub fn merge_unsorted_f64(&self, unsorted_values: Vec<f64>) -> TDigest
pub fn merge_sorted_f64(&self, sorted_values: &[f64]) -> TDigest
pub fn merge_digests<'a>( digests: impl IntoIterator<Item = &'a TDigest>, ) -> TDigest
Sourcepub fn estimate_quantile(&self, q: f64) -> f64
pub fn estimate_quantile(&self, q: f64) -> f64
To estimate the value located at q
quantile
Sourcepub fn to_scalar_state(&self) -> Vec<ScalarValue>
pub fn to_scalar_state(&self) -> Vec<ScalarValue>
This method decomposes the TDigest
and its Centroid
instances
into a series of primitive scalar values.
First the values of the TDigest are packed, followed by the variable
number of centroids packed into a ScalarValue::List
of
ScalarValue::Float64
:
┌────────┬────────┬────────┬───────┬────────┬────────┐
│max_size│ sum │ count │ max │ min │centroid│
└────────┴────────┴────────┴───────┴────────┴────────┘
│
┌─────────────────────┘
▼
┌ List ───┐
│┌ ─ ─ ─ ┐│
│ mean │
│├ ─ ─ ─ ┼│─ ─ Centroid 1
│ weight │
│└ ─ ─ ─ ┘│
│ │
│┌ ─ ─ ─ ┐│
│ mean │
│├ ─ ─ ─ ┼│─ ─ Centroid 2
│ weight │
│└ ─ ─ ─ ┘│
│ │
...
The TDigest::from_scalar_state()
method reverses this processes,
consuming the output of this method and returning an unpacked
TDigest
.
Sourcepub fn from_scalar_state(state: &[ScalarValue]) -> Self
pub fn from_scalar_state(state: &[ScalarValue]) -> Self
Unpack the serialised state of a TDigest
produced by
Self::to_scalar_state()
.
§Correctness
Providing input to this method that was not obtained from
Self::to_scalar_state()
results in undefined behaviour and may
panic.
Trait Implementations§
impl StructuralPartialEq for TDigest
Auto Trait Implementations§
impl Freeze for TDigest
impl RefUnwindSafe for TDigest
impl Send for TDigest
impl Sync for TDigest
impl Unpin for TDigest
impl UnwindSafe for TDigest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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