Arithmetic

Trait Arithmetic 

Source
pub trait Arithmetic<Op, Rhs = Self> {
    type Output;

    // Required method
    fn eval(self, rhs: Rhs) -> Self::Output;
}
Expand description

Trait for arithmetic operations.

Required Associated Types§

Source

type Output

The result type after performing the operation.

Required Methods§

Source

fn eval(self, rhs: Rhs) -> Self::Output

Perform the operation.

Implementations on Foreign Types§

Source§

impl<Op> Arithmetic<Op> for PrimitiveDatum
where for<'a, 'a> &'a PrimitiveScalar: Arithmetic<Op, &'a PrimitiveScalar, Output = PrimitiveScalar> + Arithmetic<Op, PrimitiveVector, Output = PrimitiveDatum>, for<'a, 'a> PrimitiveVector: Arithmetic<Op, &'a PrimitiveVector, Output = PrimitiveVector> + Arithmetic<Op, &'a PrimitiveScalar, Output = PrimitiveDatum>,

Source§

impl<Op> Arithmetic<Op, &PrimitiveScalar> for &PrimitiveScalar
where for<'a> &'a PScalar<f16>: Arithmetic<Op, &'a PScalar<f16>, Output = PScalar<f16>>, for<'a> &'a PScalar<f32>: Arithmetic<Op, &'a PScalar<f32>, Output = PScalar<f32>>, for<'a> &'a PScalar<f64>: Arithmetic<Op, &'a PScalar<f64>, Output = PScalar<f64>>,

Source§

impl<Op> Arithmetic<Op, &PrimitiveScalar> for PrimitiveVector
where for<'a> PVector<f16>: Arithmetic<Op, &'a f16, Output = PVector<f16>>, for<'a> PVector<f32>: Arithmetic<Op, &'a f32, Output = PVector<f32>>, for<'a> PVector<f64>: Arithmetic<Op, &'a f64, Output = PVector<f64>>,

Vector on LHS, Scalar on RHS - modifies vector in place. Returns a scalar if the input scalar is null.

Source§

impl<Op> Arithmetic<Op, &PrimitiveVector> for PrimitiveVector
where for<'a> PVector<f16>: Arithmetic<Op, &'a PVector<f16>, Output = PVector<f16>>, for<'a> PVector<f32>: Arithmetic<Op, &'a PVector<f32>, Output = PVector<f32>>, for<'a> PVector<f64>: Arithmetic<Op, &'a PVector<f64>, Output = PVector<f64>>,

Source§

impl<Op> Arithmetic<Op, PrimitiveVector> for &PrimitiveScalar
where for<'a> &'a f16: Arithmetic<Op, PVector<f16>, Output = PVector<f16>>, for<'a> &'a f32: Arithmetic<Op, PVector<f32>, Output = PVector<f32>>, for<'a> &'a f64: Arithmetic<Op, PVector<f64>, Output = PVector<f64>>,

Scalar on LHS, owned Vector on RHS - modifies vector in place. Returns a scalar if the input scalar is null.

Source§

impl<Op, T> Arithmetic<Op> for &Buffer<T>
where Op: Operator<T>,

Implementation that allocates a new output buffer.

Source§

type Output = Buffer<T>

Source§

fn eval(self, rhs: &Buffer<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op> for &PScalar<T>
where T: NativePType, Op: Operator<T>,

Source§

type Output = PScalar<T>

Source§

fn eval(self, rhs: &PScalar<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &Buffer<T>> for Buffer<T>
where T: Copy, BufferMut<T>: for<'a> Arithmetic<Op, &'a Buffer<T>, Output = Buffer<T>>, for<'a> &'a Buffer<T>: Arithmetic<Op, &'a Buffer<T>, Output = Buffer<T>>,

Implementation that attempts to downcast to a mutable buffer and operates in-place.

Source§

type Output = Buffer<T>

Source§

fn eval(self, rhs: &Buffer<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &Buffer<T>> for BufferMut<T>
where T: Copy + Zero, Op: Operator<T>,

Implementation that operates in-place over a mutable buffer.

Source§

type Output = Buffer<T>

Source§

fn eval(self, rhs: &Buffer<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &PVector<T>> for &PVector<T>
where T: NativePType, Op: Operator<T>, for<'a> &'a Buffer<T>: Arithmetic<Op, &'a Buffer<T>, Output = Buffer<T>>,

Implementation that allocates a new output vector.

Source§

type Output = PVector<T>

Source§

fn eval(self, rhs: &PVector<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &PVector<T>> for PVector<T>
where T: NativePType, Op: Operator<T>,

Implementation that attempts to downcast to a mutable vector and operates in-place.

Source§

type Output = PVector<T>

Source§

fn eval(self, rhs: &PVector<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &PVector<T>> for PVectorMut<T>
where T: NativePType, Op: Operator<T>, BufferMut<T>: for<'a> Arithmetic<Op, &'a Buffer<T>, Output = Buffer<T>>,

Implementation that operates in-place over a mutable vector.

Source§

type Output = PVector<T>

Source§

fn eval(self, other: &PVector<T>) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &T> for &Buffer<T>
where Op: Operator<T>,

Implementation that allocates a new output buffer operating against a scalar RHS value.

Source§

type Output = Buffer<T>

Source§

fn eval(self, rhs: &T) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &T> for &PVector<T>
where T: NativePType, Op: Operator<T>, for<'a> &'a Buffer<T>: Arithmetic<Op, &'a T, Output = Buffer<T>>,

Implementation that allocates a new output vector against a scalar RHS value.

Source§

type Output = PVector<T>

Source§

fn eval(self, rhs: &T) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &T> for Buffer<T>
where BufferMut<T>: for<'a> Arithmetic<Op, &'a T, Output = Buffer<T>>, for<'a> &'a Buffer<T>: Arithmetic<Op, &'a T, Output = Buffer<T>>,

Implementation that attempts to downcast to a mutable buffer and operates in-place against a scalar RHS value.

Source§

type Output = Buffer<T>

Source§

fn eval(self, rhs: &T) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &T> for BufferMut<T>
where T: Copy, Op: Operator<T>,

Implementation that operates in-place over a mutable buffer against a scalar RHS value.

Source§

type Output = Buffer<T>

Source§

fn eval(self, rhs: &T) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &T> for PVector<T>
where T: NativePType, Op: Operator<T>, PVectorMut<T>: for<'a> Arithmetic<Op, &'a T, Output = PVector<T>>,

Implementation that attempts to downcast to a mutable vector and operates in-place against a scalar RHS value.

Source§

type Output = PVector<T>

Source§

fn eval(self, rhs: &T) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, &T> for PVectorMut<T>
where T: NativePType, Op: Operator<T>, BufferMut<T>: for<'a> Arithmetic<Op, &'a T, Output = Buffer<T>>,

Implementation that operates in-place over a mutable vector against a scalar RHS value.

Source§

type Output = PVector<T>

Source§

fn eval(self, rhs: &T) -> Self::Output

Source§

impl<Op, T> Arithmetic<Op, PVector<T>> for &T
where T: NativePType, Op: Operator<T>, BufferMut<T>: for<'a> Arithmetic<Op, &'a T, Output = Buffer<T>>, for<'a> &'a Buffer<T>: Arithmetic<Op, &'a T, Output = Buffer<T>>,

Scalar LHS with owned vector RHS - modifies vector in-place.

Source§

type Output = PVector<T>

Source§

fn eval(self, rhs: PVector<T>) -> Self::Output

Implementors§