Skip to main content

Discretization

Trait Discretization 

Source
pub trait Discretization: Clone {
    // Required methods
    fn target(&self) -> u32;
    fn convert(&self, idx: usize, v: &Float) -> Float;
    fn distance(&self, idx: usize, lo: &Float, hi: &Float) -> usize;
}
Expand description

A discretization represents some subset of the real numbers (for example, f64).

Required Methods§

Source

fn target(&self) -> u32

The precision in bits needed to exactly represent a value in this subset.

Source

fn convert(&self, idx: usize, v: &Float) -> Float

Convert a bigfloat value to a value in this subset.

Source

fn distance(&self, idx: usize, lo: &Float, hi: &Float) -> usize

Determine how close two values in the subset are.

A distance of 0 indicates that the two values are equal. A distance of 2 or greater indicates that the two values are far apart. A value of exactly 1 indicates that the two values are sequential, that is, that they share a rounding boundary. This last case triggers special behavior inside Rival to handle double-rounding issues.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§