Scalar

Trait Scalar 

Source
pub trait Scalar:
    Copy
    + Send
    + Sync
    + Add<Output = Self>
    + Mul<Output = Self>
    + Zero
    + One
    + PartialEq { }
Expand description

Scalar element type for tensors.

Minimum requirements for a type to be stored in a Tensor<T>. All standard numeric types (f32, f64, Complex32, Complex64) satisfy this trait automatically via the blanket implementation.

§Examples

use tenferro_algebra::Scalar;

fn needs_scalar<T: Scalar>() {}
needs_scalar::<f64>();
needs_scalar::<f32>();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> Scalar for T
where T: Copy + Send + Sync + Add<Output = Self> + Mul<Output = Self> + Zero + One + PartialEq,