Trait Xapy

pub trait Xapy<F> {
    // Required methods
    fn xapy(&self, a: F, y: &Self) -> Self;
    fn xa(&self, a: F) -> Self;
}
Expand description

Mathematical abstraction similar to the well-known axpy method.

let a = 2.0;
let x = 33.0;
let y = 234.0;
assert_eq!(x*a + y, x.xapy(a, &y));
assert_eq!((x*a + y)*a+y, x.xapy(a, &y).xapy(a, &y));

Required Methods§

fn xapy(&self, a: F, y: &Self) -> Self

Abstraction over the common a*x + y mathematical function.

fn xa(&self, a: F) -> Self

Abstraction over scalar multiplication a*x.

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§

§

impl<F, X> Xapy<F> for X
where X: for<'a> Add<&'a X, Output = X>, &'a X: for<'a> Mul<F, Output = X>,