Skip to main content

ArithmeticOps

Trait ArithmeticOps 

Source
pub trait ArithmeticOps<A: Clone + Copy + 'static + Send + Sync> {
    // Required methods
    fn add(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
       where A: Add<Output = A>;
    fn sub(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
       where A: Sub<Output = A>;
    fn mul(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
       where A: Mul<Output = A>;
    fn div(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
       where A: Div<Output = A>;
}
Expand description

Extension trait for standard arithmetic operations on memory-mapped arrays.

This trait provides implementations of standard arithmetic operations (addition, subtraction, multiplication, division) for memory-mapped arrays using the zero-copy infrastructure.

Required Methods§

Source

fn add(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
where A: Add<Output = A>,

Adds two arrays element-wise.

§Arguments
  • other - Another memory-mapped array with the same shape
§Returns

A new memory-mapped array containing the sum

Source

fn sub(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
where A: Sub<Output = A>,

Subtracts another array from this one element-wise.

§Arguments
  • other - Another memory-mapped array with the same shape
§Returns

A new memory-mapped array containing the difference

Source

fn mul(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
where A: Mul<Output = A>,

Multiplies two arrays element-wise.

§Arguments
  • other - Another memory-mapped array with the same shape
§Returns

A new memory-mapped array containing the product

Source

fn div(&self, other: &Self) -> CoreResult<MemoryMappedArray<A>>
where A: Div<Output = A>,

Divides this array by another element-wise.

§Arguments
  • other - Another memory-mapped array with the same shape
§Returns

A new memory-mapped array containing the quotient

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A: Clone + Copy + 'static + Send + Sync + Zero> ArithmeticOps<A> for MemoryMappedArray<A>