[][src]Trait easy_ml::numeric::Numeric

pub trait Numeric: NumericByValue + for<'a> NumericByValue<&'a Self> + Clone + ZeroOne + FromUsize + Sum + PartialOrd { }

A general purpose numeric trait that defines all the behaviour numerical matrices need their types to support for math operations.

This trait extends the constraints in NumericByValue to types which also support the operations with a right hand side type by reference, and adds some additional constraints needed only by value on types.

When used together with NumericRef this expresses all 4 by value and by reference combinations for the operations using the following syntax:

This example is not tested
 fn function_name<T: Numeric>()
 where for<'a> &'a T: NumericRef<T> {

This pair of constraints is used nearly everywhere some numeric type is needed, so although this trait does not require reference type methods by itself, in practise you won't be able to call many functions in this library with a numeric type that doesn't.

Implementors

impl<T> Numeric for T where
    T: NumericByValue + for<'a> NumericByValue<&'a T> + Clone + ZeroOne + FromUsize + Sum + PartialOrd
[src]

All types implemeting the operations in NumericByValue with a right hand side type by reference are Numeric.

This covers primitives such as f32, f64, signed integers and Wrapped unsigned integers.

Loading content...