Struct sparse_interp::RelativeParams[][src]

pub struct RelativeParams<T, E = T> {
    pub zero_thresh: E,
    pub max_relative: E,
    // some fields omitted
}

A struct to use for approximate equality.

let test = RelativeParams::<f32>::new(Some(0.05), Some(0.001));
assert!(test.close_to(&1.0, &1.001));
assert!(test.close_to(&1001., &1000.));
assert!(test.close_to_zero(&-0.05));
assert!(! test.close_to(&0.1, &0.11));
assert!(! test.close_to_zero(&0.06));

Fields

zero_thresh: E

Below this threshold in absolute value, values are considered close to zero.

max_relative: E

Values not close to zero are considered close to each other if their relative error is at most this large.

Implementations

impl RelativeParams<f32, f32>[src]

pub fn new(zero_thresh: Option<f32>, max_relative: Option<f32>) -> Self[src]

Create a new closeness tester with the given parameters.

For both arguments, zero_thresh and max_relative, either the given bound is used, or machine epsilon if the argument is None.

impl RelativeParams<f64, f64>[src]

pub fn new(zero_thresh: Option<f64>, max_relative: Option<f64>) -> Self[src]

Create a new closeness tester with the given parameters.

For both arguments, zero_thresh and max_relative, either the given bound is used, or machine epsilon if the argument is None.

impl RelativeParams<Complex32, f32>[src]

pub fn new(zero_thresh: Option<f32>, max_relative: Option<f32>) -> Self[src]

Create a new closeness tester with the given parameters.

For both arguments, zero_thresh and max_relative, either the given bound is used, or machine epsilon if the argument is None.

impl RelativeParams<Complex64, f64>[src]

pub fn new(zero_thresh: Option<f64>, max_relative: Option<f64>) -> Self[src]

Create a new closeness tester with the given parameters.

For both arguments, zero_thresh and max_relative, either the given bound is used, or machine epsilon if the argument is None.

Trait Implementations

impl<T: Clone, E: Clone> Clone for RelativeParams<T, E>[src]

impl CloseTo for RelativeParams<f32, f32>[src]

type Item = f32

The type of thing that can be compared.

impl CloseTo for RelativeParams<f64, f64>[src]

type Item = f64

The type of thing that can be compared.

impl CloseTo for RelativeParams<Complex32, f32>[src]

type Item = Complex32

The type of thing that can be compared.

impl CloseTo for RelativeParams<Complex64, f64>[src]

type Item = Complex64

The type of thing that can be compared.

impl<T: Copy, E: Copy> Copy for RelativeParams<T, E>[src]

impl<T: Debug, E: Debug> Debug for RelativeParams<T, E>[src]

impl Default for RelativeParams<f32, f32>[src]

fn default() -> Self[src]

Create a closeness tester with machine epsilon precision.

impl Default for RelativeParams<f64, f64>[src]

fn default() -> Self[src]

Create a closeness tester with machine epsilon precision.

impl Default for RelativeParams<Complex32, f32>[src]

fn default() -> Self[src]

Create a closeness tester with machine epsilon precision.

impl Default for RelativeParams<Complex64, f64>[src]

fn default() -> Self[src]

Create a closeness tester with machine epsilon precision.

impl<T: Eq, E: Eq> Eq for RelativeParams<T, E>[src]

impl<T: PartialEq, E: PartialEq> PartialEq<RelativeParams<T, E>> for RelativeParams<T, E>[src]

impl<T, E> StructuralEq for RelativeParams<T, E>[src]

impl<T, E> StructuralPartialEq for RelativeParams<T, E>[src]

Auto Trait Implementations

impl<T, E> RefUnwindSafe for RelativeParams<T, E> where
    E: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, E> Send for RelativeParams<T, E> where
    E: Send,
    T: Send

impl<T, E> Sync for RelativeParams<T, E> where
    E: Sync,
    T: Sync

impl<T, E> Unpin for RelativeParams<T, E> where
    E: Unpin,
    T: Unpin

impl<T, E> UnwindSafe for RelativeParams<T, E> where
    E: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.