Trait vrl::SIMDFusedCalc

source ·
pub trait SIMDFusedCalc {
    // Required methods
    fn mul_add(self, b: Self, c: Self) -> Self;
    fn mul_sub(self, b: Self, c: Self) -> Self;
    fn nmul_add(self, b: Self, c: Self) -> Self;
    fn nmul_sub(self, b: Self, c: Self) -> Self;
}

Required Methods§

source

fn mul_add(self, b: Self, c: Self) -> Self

Multiplies vector by b and adds c to the product.

§Exmaples
let a = Vec4f::new(1.0, 2.0, 0.5, 2.0);
let b = Vec4f::new(1.0, 0.5, 2.0, 3.0);
let c = Vec4f::new(4.0, 2.0, 3.0, 1.0);
assert_eq!(a.mul_add(b, c), a * b + c);
source

fn mul_sub(self, b: Self, c: Self) -> Self

Multiplies vector by b ans substracts c from the procuct.

§Exmaples
let a = Vec4f::new(1.0, 2.0, 0.5, 2.0);
let b = Vec4f::new(1.0, 0.5, 2.0, 3.0);
let c = Vec4f::new(4.0, 2.0, 3.0, 1.0);
assert_eq!(a.mul_sub(b, c), a * b - c);
source

fn nmul_add(self, b: Self, c: Self) -> Self

Multiplies vector by b and substracts the product from c.

§Exmaples
let a = Vec4f::new(1.0, 2.0, 0.5, 2.0);
let b = Vec4f::new(1.0, 0.5, 2.0, 3.0);
let c = Vec4f::new(4.0, 2.0, 3.0, 1.0);
assert_eq!(a.nmul_add(b, c), c - a * b);
source

fn nmul_sub(self, b: Self, c: Self) -> Self

Multiplies vector by b and substracts the product from -c.

§Exmaples
let a = Vec4f::new(1.0, 2.0, 0.5, 2.0);
let b = Vec4f::new(1.0, 0.5, 2.0, 3.0);
let c = Vec4f::new(4.0, 2.0, 3.0, 1.0);
assert_eq!(a.nmul_sub(b, c), -(a * b + c));

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: SIMDFusedCalcFallback + Arithmetic + Neg<Output = Self>> SIMDFusedCalc for T