Trait VAbs

Source
pub trait VAbs: Vector {
    type Output;

    // Required methods
    fn abs_sqr(&self) -> Self::Output;
    fn abs(&self) -> Self::Output;
}

Required Associated Types§

Required Methods§

Source

fn abs_sqr(&self) -> Self::Output

Returns the square euclidian absolute value of any vector-array

||u||²

§Examples
let u = [1.0, 2.0];
let u_abs_sqr = u[0]*u[0] + u[1]*u[1];
 
assert_eq!(u.abs_sqr(), u_abs_sqr);
Source

fn abs(&self) -> Self::Output

Returns the euclidian absolute value of any vector-array

||u||

§Examples
let u = [1.0, 2.0];
let u_abs = (u[0]*u[0] + u[1]*u[1]).sqrt();
 
assert_eq!(u.abs(), u_abs);

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.

Implementations on Foreign Types§

Source§

impl<F: Float, const N: usize> VAbs for [Complex<F>; N]

Source§

type Output = F

Source§

fn abs_sqr(&self) -> Self::Output

Source§

fn abs(&self) -> Self::Output

Source§

impl<const N: usize> VAbs for [f32; N]

Source§

type Output = f32

Source§

fn abs_sqr(&self) -> Self::Output

Source§

fn abs(&self) -> Self::Output

Source§

impl<const N: usize> VAbs for [f64; N]

Source§

type Output = f64

Source§

fn abs_sqr(&self) -> Self::Output

Source§

fn abs(&self) -> Self::Output

Implementors§