Struct Error

Source
pub struct Error<F, In> { /* private fields */ }
Expand description

Aggregator structure that compares computed and real values, input by input, computes the corresponding errors and stores them.

The first generic parameter specifies the type of floating point used. The second one specifies the input argument(s). In most cases, this will be a single floating point number, however, for multiple argument functions this can be a tuple.

Implementations§

Source§

impl<F: FloatExt, In: Debug + Default + Copy> Error<F, In>

Source

pub fn new() -> Self

Initializes the structure without any bounds.

Source

pub fn with_bounds(bounds: ErrorBounds<F>) -> Self

Initializes the structure with given bounds.

Source

pub fn calculate(&mut self, arg: In, computed: F, real: F)

Calculates the errors between computed value and real value. If it is the current maximum, its value is stored along with the argument that caused it.

Source

pub fn max_rel(&self) -> F

Returns maximum relative error encountered.

Source

pub fn max_rel_arg(&self) -> In

Returns the argument for maximum relative error encountered.

Source

pub fn max_abs(&self) -> F

Returns maximum absolute error encountered.

Source

pub fn max_abs_arg(&self) -> In

Returns the argument for absolute relative error encountered.

Source

pub fn rms(&self) -> F

Returns root-mean-square error for all values encountered.

Source

pub fn assert(&self)

Asserts the bounds for the errors that were encountered.

Source

pub fn print_plain(&self, name: &str)

Prints the errors (and arguments) in a plain, human-readable form.

Source

pub fn print_csv(&self, name: &str)

Prints the errors (and arguments) as one line in CSV format. Use print_csv_header method to print the header for the CSV file.

Source

pub fn print_csv_header()

Prints the header for CSV file which contents are given by print_csv method.

Auto Trait Implementations§

§

impl<F, In> Freeze for Error<F, In>
where F: Freeze, In: Freeze,

§

impl<F, In> RefUnwindSafe for Error<F, In>

§

impl<F, In> Send for Error<F, In>
where F: Send, In: Send,

§

impl<F, In> Sync for Error<F, In>
where F: Sync, In: Sync,

§

impl<F, In> Unpin for Error<F, In>
where F: Unpin, In: Unpin,

§

impl<F, In> UnwindSafe for Error<F, In>
where F: UnwindSafe, In: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V