Trait sparse_interp::CloseTo[][src]

pub trait CloseTo {
    type Item;
    fn close_to(&self, x: &Self::Item, y: &Self::Item) -> bool;
fn close_to_zero(&self, x: &Self::Item) -> bool; 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>
, { ... } }

A possibly-stateful comparison for exact or approximate types.

Implementors of this trait can be used to compare Items for “closeness”. The idea is that closeness should encompass absolute equality as well as approximate equality.

For exact types, use the CloseToEq struct to just fall back to direct comparison. For inexact types, use the RelativeParams struct to specify the acceptable (relative) error.

Associated Types

type Item[src]

The type of thing that can be compared.

Loading content...

Required methods

fn close_to(&self, x: &Self::Item, y: &Self::Item) -> bool[src]

Returns true iff x is approximatey equal to y.

fn close_to_zero(&self, x: &Self::Item) -> bool[src]

Indicates true if x is approximately zero.

Loading content...

Provided methods

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]

Checks closeness over an iteration.

Loading content...

Implementors

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

type Item = f32

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

type Item = f64

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

type Item = Complex32

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

type Item = Complex64

impl<T: PartialEq> CloseTo for CloseToEq<T>[src]

type Item = T

Loading content...