Struct sparse_interp::RelativeParams [−][src]
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]
fn clone(&self) -> RelativeParams<T, E>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl CloseTo for RelativeParams<f32, f32>
[src]
type Item = f32
The type of thing that can be compared.
fn close_to(&self, x: &Self::Item, y: &Self::Item) -> bool
[src]
fn close_to_zero(&self, x: &Self::Item) -> bool
[src]
fn close_to_iter<'a, Iter1, Iter2>(&'a self, x: Iter1, y: Iter2) -> bool where
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
[src]
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
impl CloseTo for RelativeParams<f64, f64>
[src]
type Item = f64
The type of thing that can be compared.
fn close_to(&self, x: &Self::Item, y: &Self::Item) -> bool
[src]
fn close_to_zero(&self, x: &Self::Item) -> bool
[src]
fn close_to_iter<'a, Iter1, Iter2>(&'a self, x: Iter1, y: Iter2) -> bool where
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
[src]
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
impl CloseTo for RelativeParams<Complex32, f32>
[src]
type Item = Complex32
The type of thing that can be compared.
fn close_to(&self, x: &Self::Item, y: &Self::Item) -> bool
[src]
fn close_to_zero(&self, x: &Self::Item) -> bool
[src]
fn close_to_iter<'a, Iter1, Iter2>(&'a self, x: Iter1, y: Iter2) -> bool where
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
[src]
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
impl CloseTo for RelativeParams<Complex64, f64>
[src]
type Item = Complex64
The type of thing that can be compared.
fn close_to(&self, x: &Self::Item, y: &Self::Item) -> bool
[src]
fn close_to_zero(&self, x: &Self::Item) -> bool
[src]
fn close_to_iter<'a, Iter1, Iter2>(&'a self, x: Iter1, y: Iter2) -> bool where
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
[src]
Iter1: Iterator<Item = &'a Self::Item>,
Iter2: Iterator<Item = &'a Self::Item>,
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]
impl Default for RelativeParams<f64, f64>
[src]
impl Default for RelativeParams<Complex32, f32>
[src]
impl Default for RelativeParams<Complex64, f64>
[src]
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]
fn eq(&self, other: &RelativeParams<T, E>) -> bool
[src]
fn ne(&self, other: &RelativeParams<T, E>) -> bool
[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,
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, E> Send for RelativeParams<T, E> where
E: Send,
T: Send,
E: Send,
T: Send,
impl<T, E> Sync for RelativeParams<T, E> where
E: Sync,
T: Sync,
E: Sync,
T: Sync,
impl<T, E> Unpin for RelativeParams<T, E> where
E: Unpin,
T: Unpin,
E: Unpin,
T: Unpin,
impl<T, E> UnwindSafe for RelativeParams<T, E> where
E: UnwindSafe,
T: UnwindSafe,
E: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,