Struct Array

Source
pub struct Array<const D: usize> { /* private fields */ }

Implementations§

Source§

impl<const D: usize> Array<D>

Source

pub fn zeros(shape: &[usize; D]) -> Self

Source

pub fn new_from_value(shape: &[usize; D], value: f32) -> Self

Source

pub fn random_seed() -> [u32; 16]

Source

pub fn random_uniform(shape: &[usize; D], seed: [u32; 16]) -> Self

Source

pub fn random_uniform_in_place(&mut self, seed: [u32; 16]) -> [u32; 16]

Source

pub fn set_all(&mut self, value: f32)

Source

pub fn set_masked(&mut self, value: f32, mask: &Mask<D>)

set the elements to value where mask is 1

Source

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

Source

pub fn copy(&mut self, other: &Array<D>)

Source

pub fn copy_masked(&mut self, other: &Array<D>, mask: &Mask<D>)

Source

pub fn copy_masked2( &mut self, other1: &Array<D>, other2: &Array<D>, mask: &Mask<D>, )

Source

pub fn add(&self, other: &Self) -> Self

Source

pub fn add_in_place(&mut self, other: &Self)

Source

pub fn add_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)

Source

pub fn add_out_of_place(&self, other: &Self, output: &mut Self)

Source

pub fn sub(&self, other: &Self) -> Self

Source

pub fn sub_in_place(&mut self, other: &Self)

Source

pub fn sub_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)

Source

pub fn sub_out_of_place(&self, other: &Self, output: &mut Self)

Source

pub fn mul(&self, other: &Self) -> Self

Source

pub fn mul_in_place(&mut self, other: &Self)

Source

pub fn mul_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)

Source

pub fn mul_out_of_place(&self, other: &Self, output: &mut Self)

Source

pub fn div(&self, other: &Self) -> Self

Source

pub fn div_in_place(&mut self, other: &Self)

Source

pub fn div_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)

Source

pub fn div_out_of_place(&self, other: &Self, output: &mut Self)

Source

pub fn max(&self, other: &Self) -> Self

Source

pub fn max_in_place(&mut self, other: &Self)

Source

pub fn max_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)

Source

pub fn max_out_of_place(&self, other: &Self, output: &mut Self)

Source

pub fn max_scalar(&self, scalar: f32) -> Self

Source

pub fn max_scalar_in_place(&mut self, scalar: f32)

Source

pub fn max_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)

Source

pub fn min(&self, other: &Self) -> Self

Source

pub fn min_in_place(&mut self, other: &Self)

Source

pub fn min_in_place_masked(&mut self, other: &Self, mask: &Mask<D>)

Source

pub fn min_out_of_place(&self, other: &Self, output: &mut Self)

Source

pub fn min_scalar(&self, scalar: f32) -> Self

Source

pub fn min_scalar_in_place(&mut self, scalar: f32)

Source

pub fn min_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)

Source

pub fn add_scalar(&self, scalar: f32) -> Self

Source

pub fn add_scalar_in_place(&mut self, scalar: f32)

Source

pub fn add_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)

Source

pub fn sub_scalar(&self, scalar: f32) -> Self

Source

pub fn sub_scalar_in_place(&mut self, scalar: f32)

Source

pub fn sub_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)

Source

pub fn mul_scalar(&self, scalar: f32) -> Self

Source

pub fn mul_scalar_in_place(&mut self, scalar: f32)

Source

pub fn mul_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)

Source

pub fn div_scalar(&self, scalar: f32) -> Self

Source

pub fn div_scalar_in_place(&mut self, scalar: f32)

Source

pub fn div_scalar_in_place_masked(&mut self, scalar: f32, mask: &Mask<D>)

Source

pub fn fmadd(&self, a: &Self, b: &Self) -> Self

Source

pub fn fmadd_in_place(&mut self, a: &Self, b: &Self)

Source

pub fn fmadd_in_place_masked(&mut self, a: &Self, b: &Self, mask: &Mask<D>)

Source

pub fn fmadd_scalar(&self, a: &Self, scalar: f32) -> Self

Source

pub fn fmadd_scalar_in_place(&mut self, a: &Self, scalar: f32)

Source

pub fn fmadd_scalar_in_place_masked( &mut self, a: &Self, scalar: f32, mask: &Mask<D>, )

Source

pub fn sqrt(&self) -> Self

Source

pub fn sqrt_in_place(&mut self)

Source

pub fn sqrt_in_place_masked(&mut self, mask: &Mask<D>)

Source

pub fn square(&self) -> Self

Source

pub fn square_in_place(&mut self)

Source

pub fn square_in_place_masked(&mut self, mask: &Mask<D>)

Source

pub fn abs(&self) -> Self

Source

pub fn abs_in_place(&mut self)

Source

pub fn abs_in_place_masked(&mut self, mask: &Mask<D>)

Source

pub fn sum(&self) -> f32

Source

pub fn product(&self) -> f32

Source

pub fn max_reduce(&self) -> f32

Source

pub fn min_reduce(&self) -> f32

Source

pub fn compare_equal(&self, other: &Self) -> Mask<D>

Source

pub fn compare_equal_in_place(&self, other: &Self, mask: &mut Mask<D>)

Source

pub fn compare_scalar_equal(&self, scalar: f32) -> Mask<D>

Source

pub fn compare_scalar_equal_in_place(&self, scalar: f32, mask: &mut Mask<D>)

Source

pub fn compare_not_equal(&self, other: &Self) -> Mask<D>

Source

pub fn compare_not_equal_in_place(&self, other: &Self, mask: &mut Mask<D>)

Source

pub fn compare_scalar_not_equal(&self, scalar: f32) -> Mask<D>

Source

pub fn compare_scalar_not_equal_in_place(&self, scalar: f32, mask: &mut Mask<D>)

Source

pub fn compare_greater_than(&self, other: &Self) -> Mask<D>

Source

pub fn compare_greater_than_in_place(&self, other: &Self, mask: &mut Mask<D>)

Source

pub fn compare_scalar_greater_than(&self, scalar: f32) -> Mask<D>

Source

pub fn compare_scalar_greater_than_in_place( &self, scalar: f32, mask: &mut Mask<D>, )

Source

pub fn compare_greater_than_or_equal(&self, other: &Self) -> Mask<D>

Source

pub fn compare_greater_than_or_equal_in_place( &self, other: &Self, mask: &mut Mask<D>, )

Source

pub fn compare_scalar_greater_than_or_equal(&self, scalar: f32) -> Mask<D>

Source

pub fn compare_scalar_greater_than_or_equal_in_place( &self, scalar: f32, mask: &mut Mask<D>, )

Source

pub fn compare_less_than(&self, other: &Self) -> Mask<D>

Source

pub fn compare_less_than_in_place(&self, other: &Self, mask: &mut Mask<D>)

Source

pub fn compare_scalar_less_than(&self, scalar: f32) -> Mask<D>

Source

pub fn compare_scalar_less_than_in_place(&self, scalar: f32, mask: &mut Mask<D>)

Source

pub fn compare_less_than_or_equal(&self, other: &Self) -> Mask<D>

Source

pub fn compare_less_than_or_equal_in_place( &self, other: &Self, mask: &mut Mask<D>, )

Source

pub fn compare_scalar_less_than_or_equal(&self, scalar: f32) -> Mask<D>

Source

pub fn compare_scalar_less_than_or_equal_in_place( &self, scalar: f32, mask: &mut Mask<D>, )

Source

pub fn exp(&self) -> Self

Source

pub fn exp_in_place(&mut self)

Source§

impl Array<1>

Source

pub fn get(&self, index: usize) -> f32

Source

pub fn set(&mut self, index: usize, value: f32)

Source

pub fn dot_product(&self, other: &Self) -> f32

Source

pub fn tile_in_place(&self, k: usize, output: &mut Array<1>)

Copy the array k-times into output

Source

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

Source

pub fn repeat_as_row_in_place(&self, k: usize, output: &mut Array<2>)

Source

pub fn repeat_as_column_in_place(&self, k: usize, output: &mut Array<2>)

Source§

impl Array<2>

Source

pub fn from_vec(data: &Vec<f32>, shape: [usize; 2]) -> Self

Source

pub fn get(&self, row: usize, column: usize) -> f32

Source

pub fn set(&mut self, row: usize, column: usize, value: f32)

Source

pub fn vector_multiplication(&self, other: &Array<1>) -> Array<1>

Source

pub fn matrix_multiplication(&self, matrix_b: &Self) -> Self

Source

pub fn sum_to_row_in_place_masked(&self, mask: &Mask<2>, output: &mut Array<1>)

Source

pub fn sum_to_column_in_place_masked( &self, mask: &Mask<2>, output: &mut Array<1>, )

Source§

impl<const D: usize> Array<D>

Source

pub fn get_shape(&self) -> [usize; D]

Source§

impl<const D: usize> Array<D>

Trait Implementations§

Source§

impl<const D: usize> Clone for Array<D>

Source§

fn clone(&self) -> Array<D>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de, const D: usize> Deserialize<'de> for Array<D>

Source§

fn deserialize<De>(deserializer: De) -> Result<Self, De::Error>
where De: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const D: usize> From<Array<D>> for Vec<f32>

Source§

fn from(value: Array<D>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<f32>> for Array<1>

Source§

fn from(value: Vec<f32>) -> Self

Converts to this type from the input type.
Source§

impl<const D: usize> Serialize for Array<D>

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,