pub struct LogarithmicMapping { /* private fields */ }Expand description
Logarithmic index mapping.
Maps values to indices using: index = ceil(log(value) / log(gamma)) where gamma = (1 + alpha) / (1 - alpha) and
alpha is the relative accuracy.
Implementations§
Source§impl LogarithmicMapping
impl LogarithmicMapping
Sourcepub fn new(relative_accuracy: f64) -> Result<Self, &'static str>
pub fn new(relative_accuracy: f64) -> Result<Self, &'static str>
Creates a new LogarithmicMapping with the given relative accuracy.
The relative accuracy must be between 0 and 1 (inclusive).
§Errors
If the relative accuracy is out of bounds, an error is returned.
§Example
use ddsketch::canonical::mapping::LogarithmicMapping;
// Create a mapping with 1% relative accuracy
let mapping = LogarithmicMapping::new(0.01).unwrap();Sourcepub fn new_with_gamma(gamma: f64) -> Result<Self, &'static str>
pub fn new_with_gamma(gamma: f64) -> Result<Self, &'static str>
Creates a new LogarithmicMapping from an explicit logarithmic base.
This constructor is useful when the caller already knows the desired gamma
and wants to build the mapping directly instead of deriving it from relative
accuracy.
gamma must be greater than 1.0, otherwise the logarithmic mapping is
invalid.
§Errors
Returns an error if gamma <= 1.0.
Sourcepub fn new_with_gamma_and_offset(
gamma: f64,
index_offset: f64,
) -> Result<Self, &'static str>
pub fn new_with_gamma_and_offset( gamma: f64, index_offset: f64, ) -> Result<Self, &'static str>
Creates a new LogarithmicMapping from an explicit logarithmic base and index offset.
gamma must be greater than 1.0, otherwise the logarithmic mapping is
invalid.
§Errors
Returns an error if gamma <= 1.0.
Trait Implementations§
Source§impl Clone for LogarithmicMapping
impl Clone for LogarithmicMapping
Source§fn clone(&self) -> LogarithmicMapping
fn clone(&self) -> LogarithmicMapping
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LogarithmicMapping
impl Debug for LogarithmicMapping
Source§impl Default for LogarithmicMapping
impl Default for LogarithmicMapping
Source§impl IndexMapping for LogarithmicMapping
impl IndexMapping for LogarithmicMapping
Source§fn index(&self, value: f64) -> i32
fn index(&self, value: f64) -> i32
Source§fn value(&self, index: i32) -> f64
fn value(&self, index: i32) -> f64
Source§fn lower_bound(&self, index: i32) -> f64
fn lower_bound(&self, index: i32) -> f64
Source§fn relative_accuracy(&self) -> f64
fn relative_accuracy(&self) -> f64
Source§fn min_indexable_value(&self) -> f64
fn min_indexable_value(&self) -> f64
Source§fn max_indexable_value(&self) -> f64
fn max_indexable_value(&self) -> f64
Source§fn index_offset(&self) -> f64
fn index_offset(&self) -> f64
Source§fn interpolation(&self) -> Interpolation
fn interpolation(&self) -> Interpolation
Source§fn validate_proto_mapping(
&self,
proto: &ProtoIndexMapping,
) -> Result<(), ProtoConversionError>
fn validate_proto_mapping( &self, proto: &ProtoIndexMapping, ) -> Result<(), ProtoConversionError>
IndexMapping is compatible with this mapping. Read moreSource§impl PartialEq for LogarithmicMapping
impl PartialEq for LogarithmicMapping
impl StructuralPartialEq for LogarithmicMapping
Auto Trait Implementations§
impl Freeze for LogarithmicMapping
impl RefUnwindSafe for LogarithmicMapping
impl Send for LogarithmicMapping
impl Sync for LogarithmicMapping
impl Unpin for LogarithmicMapping
impl UnsafeUnpin for LogarithmicMapping
impl UnwindSafe for LogarithmicMapping
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request