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();Trait Implementations§
Source§impl Clone for LogarithmicMapping
impl Clone for LogarithmicMapping
Source§fn clone(&self) -> LogarithmicMapping
fn clone(&self) -> LogarithmicMapping
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Returns the index of the bin for the given positive value. Read more
Source§fn value(&self, index: i32) -> f64
fn value(&self, index: i32) -> f64
Returns the representative value for the given index. Read more
Source§fn lower_bound(&self, index: i32) -> f64
fn lower_bound(&self, index: i32) -> f64
Returns the lower bound of the bin at the given index.
Source§fn relative_accuracy(&self) -> f64
fn relative_accuracy(&self) -> f64
Returns the relative accuracy of this mapping. Read more
Source§fn min_indexable_value(&self) -> f64
fn min_indexable_value(&self) -> f64
Returns the minimum positive value that can be indexed.
Source§fn max_indexable_value(&self) -> f64
fn max_indexable_value(&self) -> f64
Returns the maximum positive value that can be indexed.
Source§fn index_offset(&self) -> f64
fn index_offset(&self) -> f64
Returns the index offset used by this mapping. Read more
Source§fn interpolation(&self) -> Interpolation
fn interpolation(&self) -> Interpolation
Returns the interpolation mode used by this mapping. Read more
Source§fn validate_proto_mapping(
&self,
proto: &ProtoIndexMapping,
) -> Result<(), ProtoConversionError>
fn validate_proto_mapping( &self, proto: &ProtoIndexMapping, ) -> Result<(), ProtoConversionError>
Validates that a protobuf
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 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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
T in a tonic::Request