pub struct Array<const D: usize> { /* private fields */ }
Implementations§
Source§impl<const D: usize> Array<D>
impl<const D: usize> Array<D>
pub fn zeros(shape: &[usize; D]) -> Self
pub fn new_from_value(shape: &[usize; D], value: f32) -> Self
pub fn random_seed() -> [u32; 16]
pub fn random_uniform(shape: &[usize; D], seed: [u32; 16]) -> Self
pub fn random_uniform_in_place(&mut self, seed: [u32; 16]) -> [u32; 16]
pub fn set_all(&mut self, value: f32)
Sourcepub fn set_masked(&mut self, value: f32, mask: &Mask<D>)
pub fn set_masked(&mut self, value: f32, mask: &Mask<D>)
set the elements to value
where mask
is 1
Sourcepub fn set_masked2(&mut self, v1: f32, v2: f32, mask: &Mask<D>)
pub fn set_masked2(&mut self, v1: f32, v2: f32, mask: &Mask<D>)
set the elements to v1
where mask
is 0 and to v2
where mask
is 1
pub fn copy(&mut self, other: &Array<D>)
pub fn copy_masked(&mut self, other: &Array<D>, mask: &Mask<D>)
pub fn copy_masked2( &mut self, other1: &Array<D>, other2: &Array<D>, mask: &Mask<D>, )
pub fn add(&self, other: &Self) -> Self
pub fn add_in_place(&mut self, other: &Self)
pub fn add_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)
pub fn add_out_of_place(&self, other: &Self, output: &mut Self)
pub fn sub(&self, other: &Self) -> Self
pub fn sub_in_place(&mut self, other: &Self)
pub fn sub_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)
pub fn sub_out_of_place(&self, other: &Self, output: &mut Self)
pub fn mul(&self, other: &Self) -> Self
pub fn mul_in_place(&mut self, other: &Self)
pub fn mul_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)
pub fn mul_out_of_place(&self, other: &Self, output: &mut Self)
pub fn div(&self, other: &Self) -> Self
pub fn div_in_place(&mut self, other: &Self)
pub fn div_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)
pub fn div_out_of_place(&self, other: &Self, output: &mut Self)
pub fn max(&self, other: &Self) -> Self
pub fn max_in_place(&mut self, other: &Self)
pub fn max_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)
pub fn max_out_of_place(&self, other: &Self, output: &mut Self)
pub fn max_scalar(&self, scalar: f32) -> Self
pub fn max_scalar_in_place(&mut self, scalar: f32)
pub fn max_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)
pub fn min(&self, other: &Self) -> Self
pub fn min_in_place(&mut self, other: &Self)
pub fn min_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)
pub fn min_out_of_place(&self, other: &Self, output: &mut Self)
pub fn min_scalar(&self, scalar: f32) -> Self
pub fn min_scalar_in_place(&mut self, scalar: f32)
pub fn min_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)
pub fn add_scalar(&self, scalar: f32) -> Self
pub fn add_scalar_in_place(&mut self, scalar: f32)
pub fn add_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)
pub fn sub_scalar(&self, scalar: f32) -> Self
pub fn sub_scalar_in_place(&mut self, scalar: f32)
pub fn sub_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)
pub fn mul_scalar(&self, scalar: f32) -> Self
pub fn mul_scalar_in_place(&mut self, scalar: f32)
pub fn mul_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)
pub fn div_scalar(&self, scalar: f32) -> Self
pub fn div_scalar_in_place(&mut self, scalar: f32)
pub fn div_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)
pub fn fmadd(&self, a: &Self, b: &Self) -> Self
pub fn fmadd_in_place(&mut self, a: &Self, b: &Self)
pub fn fmadd_in_place_masked(&mut self, a: &Self, b: &Self, mask: &Mask<D>)
pub fn fmadd_scalar(&self, a: &Self, scalar: f32) -> Self
pub fn fmadd_scalar_in_place(&mut self, a: &Self, scalar: f32)
pub fn fmadd_scalar_in_place_masked( &mut self, a: &Self, scalar: f32, mask: &Mask<D>, )
pub fn sqrt(&self) -> Self
pub fn sqrt_in_place(&mut self)
pub fn sqrt_in_place_masked(&mut self, mask: &Mask<D>)
pub fn square(&self) -> Self
pub fn square_in_place(&mut self)
pub fn square_in_place_masked(&mut self, mask: &Mask<D>)
pub fn abs(&self) -> Self
pub fn abs_in_place(&mut self)
pub fn abs_in_place_masked(&mut self, mask: &Mask<D>)
pub fn sum(&self) -> f32
pub fn product(&self) -> f32
pub fn max_reduce(&self) -> f32
pub fn min_reduce(&self) -> f32
pub fn compare_equal(&self, other: &Self) -> Mask<D>
pub fn compare_equal_in_place(&self, other: &Self, mask: &mut Mask<D>)
pub fn compare_scalar_equal(&self, scalar: f32) -> Mask<D>
pub fn compare_scalar_equal_in_place(&self, scalar: f32, mask: &mut Mask<D>)
pub fn compare_not_equal(&self, other: &Self) -> Mask<D>
pub fn compare_not_equal_in_place(&self, other: &Self, mask: &mut Mask<D>)
pub fn compare_scalar_not_equal(&self, scalar: f32) -> Mask<D>
pub fn compare_scalar_not_equal_in_place(&self, scalar: f32, mask: &mut Mask<D>)
pub fn compare_greater_than(&self, other: &Self) -> Mask<D>
pub fn compare_greater_than_in_place(&self, other: &Self, mask: &mut Mask<D>)
pub fn compare_scalar_greater_than(&self, scalar: f32) -> Mask<D>
pub fn compare_scalar_greater_than_in_place( &self, scalar: f32, mask: &mut Mask<D>, )
pub fn compare_greater_than_or_equal(&self, other: &Self) -> Mask<D>
pub fn compare_greater_than_or_equal_in_place( &self, other: &Self, mask: &mut Mask<D>, )
pub fn compare_scalar_greater_than_or_equal(&self, scalar: f32) -> Mask<D>
pub fn compare_scalar_greater_than_or_equal_in_place( &self, scalar: f32, mask: &mut Mask<D>, )
pub fn compare_less_than(&self, other: &Self) -> Mask<D>
pub fn compare_less_than_in_place(&self, other: &Self, mask: &mut Mask<D>)
pub fn compare_scalar_less_than(&self, scalar: f32) -> Mask<D>
pub fn compare_scalar_less_than_in_place(&self, scalar: f32, mask: &mut Mask<D>)
pub fn compare_less_than_or_equal(&self, other: &Self) -> Mask<D>
pub fn compare_less_than_or_equal_in_place( &self, other: &Self, mask: &mut Mask<D>, )
pub fn compare_scalar_less_than_or_equal(&self, scalar: f32) -> Mask<D>
pub fn compare_scalar_less_than_or_equal_in_place( &self, scalar: f32, mask: &mut Mask<D>, )
pub fn exp(&self) -> Self
pub fn exp_in_place(&mut self)
Source§impl Array<1>
impl Array<1>
pub fn get(&self, index: usize) -> f32
pub fn set(&mut self, index: usize, value: f32)
pub fn dot_product(&self, other: &Self) -> f32
Sourcepub fn tile_in_place(&self, k: usize, output: &mut Array<1>)
pub fn tile_in_place(&self, k: usize, output: &mut Array<1>)
Copy the array k
-times into output
Sourcepub fn repeat_in_place(&self, k: usize, output: &mut Array<1>)
pub fn repeat_in_place(&self, k: usize, output: &mut Array<1>)
Repeat each element of the array k
-times and store the result in output
pub fn repeat_as_row_in_place(&self, k: usize, output: &mut Array<2>)
pub fn repeat_as_column_in_place(&self, k: usize, output: &mut Array<2>)
Source§impl Array<2>
impl Array<2>
pub fn from_vec(data: &Vec<f32>, shape: [usize; 2]) -> Self
pub fn get(&self, row: usize, column: usize) -> f32
pub fn set(&mut self, row: usize, column: usize, value: f32)
pub fn vector_multiplication(&self, other: &Array<1>) -> Array<1>
pub fn matrix_multiplication(&self, matrix_b: &Self) -> Self
pub fn sum_to_row_in_place_masked(&self, mask: &Mask<2>, output: &mut Array<1>)
pub fn sum_to_column_in_place_masked( &self, mask: &Mask<2>, output: &mut Array<1>, )
Trait Implementations§
Source§impl<'de, const D: usize> Deserialize<'de> for Array<D>
impl<'de, const D: usize> Deserialize<'de> for Array<D>
Source§fn deserialize<De>(deserializer: De) -> Result<Self, De::Error>where
De: Deserializer<'de>,
fn deserialize<De>(deserializer: De) -> Result<Self, De::Error>where
De: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<const D: usize> Freeze for Array<D>
impl<const D: usize> RefUnwindSafe for Array<D>
impl<const D: usize> Send for Array<D>
impl<const D: usize> Sync for Array<D>
impl<const D: usize> Unpin for Array<D>
impl<const D: usize> UnwindSafe for Array<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more