Array

Enum Array 

Source
pub enum Array {
    Bool(ArrayExt<bool>),
    C32(ArrayExt<Complex<f32>>),
    C64(ArrayExt<Complex<f64>>),
    F32(ArrayExt<f32>),
    F64(ArrayExt<f64>),
    I16(ArrayExt<i16>),
    I32(ArrayExt<i32>),
    I64(ArrayExt<i64>),
    U8(ArrayExt<u8>),
    U16(ArrayExt<u16>),
    U32(ArrayExt<u32>),
    U64(ArrayExt<u64>),
}
Expand description

A generic one-dimensional array which supports all variants of NumberType.

Variants§

Implementations§

Source§

impl Array

Source

pub fn type_cast<T: HasAfEnum>(&self) -> ArrayExt<T>

Cast the values of this array into an ArrayExt<T>.

Source

pub fn concatenate(left: &Array, right: &Array) -> Array

Concatenate two Arrays.

Source

pub fn constant(value: Number, length: usize) -> Array

Construct a new Array with the given constant value and length.

Source

pub fn random_normal(dtype: FloatType, length: usize) -> Array

Construct a new Array with a random normal distribution.

Source

pub fn random_uniform(dtype: FloatType, length: usize) -> Array

Construct a new Array with a uniform random distribution.

Source

pub fn dtype(&self) -> NumberType

The NumberType of this Array.

Source

pub fn cast_into(&self, dtype: NumberType) -> Array

Cast into an Array of a different NumberType.

Source

pub fn to_vec(&self) -> Vec<Number>

Copy the contents of this Array into a new Vec.

Source

pub fn abs(&self) -> Array

Calculate the element-wise absolute value.

Source

pub fn all(&self) -> bool

Returns true if all elements of this Array are nonzero.

Source

pub fn any(&self) -> bool

Returns true if any element of this Array is nonzero.

Source

pub fn and(&self, other: &Array) -> Array

Element-wise logical and.

Source

pub fn and_const(&self, other: Number) -> Array

Element-wise logical and, relative to a constant other.

Source

pub fn argmax(&self) -> (usize, Number)

Find the maximum value in this Array and its offset.

Source

pub fn eq(&self, other: &Array) -> Array

Element-wise equality comparison.

Source

pub fn eq_const(&self, other: Number) -> Array

Element-wise equality comparison.

Source

pub fn exp(&self) -> Array

Raise e to the power of self.

Source

pub fn gt(&self, other: &Array) -> Array

Element-wise greater-than comparison.

Source

pub fn gt_const(&self, other: Number) -> Array

Element-wise greater-than comparison.

Source

pub fn gte(&self, other: &Array) -> Array

Element-wise greater-or-equal comparison.

Source

pub fn gte_const(&self, other: Number) -> Array

Element-wise greater-than-or-equal comparison.

Source

pub fn is_infinite(&self) -> Array

Element-wise check for infinite values.

Source

pub fn is_nan(&self) -> Array

Element-wise check for non-numeric (NaN) values.

Source

pub fn ln(&self) -> Array

Compute the natural log of this Array.

Source

pub fn log(&self, base: &Array) -> Array

Compute the logarithm of this Array with respect to the given base.

Source

pub fn log_const(&self, base: Number) -> Array

Compute the logarithm of this Array with respect to the given constant base.

Source

pub fn lt(&self, other: &Array) -> Array

Element-wise less-than comparison.

Source

pub fn lt_const(&self, other: Number) -> Array

Element-wise less-than comparison.

Source

pub fn lte(&self, other: &Array) -> Array

Element-wise less-or-equal comparison.

Source

pub fn lte_const(&self, other: Number) -> Array

Element-wise less-than-or-equal comparison.

Source

pub fn ne(&self, other: &Array) -> Array

Element-wise inequality comparison.

Source

pub fn ne_const(&self, other: Number) -> Array

Element-wise not-equal comparison.

Source

pub fn not(&self) -> Array

Element-wise logical not.

Source

pub fn or(&self, other: &Array) -> Array

Element-wise logical or.

Source

pub fn or_const(&self, other: Number) -> Array

Element-wise logical or, relative to a constant other.

Source

pub fn reduce_max(&self, stride: u64) -> Result<Array>

Find the maximum value of each stride of this Array

Source

pub fn reduce_min(&self, stride: u64) -> Result<Array>

Find the maximum value of each stride of this Array

Source

pub fn reduce_product(&self, stride: u64) -> Result<Array>

Compute the product of each stride of this Array

Source

pub fn reduce_sum(&self, stride: u64) -> Result<Array>

Compute the sum of each stride of a single block

Source

pub fn max(&self) -> Number

Find the maximum element in this Array.

Source

pub fn min(&self) -> Number

Find the maximum element in this Array.

Source

pub fn product(&self) -> Number

Calculate the cumulative product of this Array.

Source

pub fn sum(&self) -> Number

Calculate the cumulative sum of this Array.

Source

pub fn len(&self) -> usize

The number of elements in this Array.

Source

pub fn get_value(&self, index: usize) -> Number

Get the value at the specified index.

Source

pub fn get(&self, index: &ArrayExt<u64>) -> Self

Get the values at the specified coordinates.

Source

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

Return this Array raised to the power of other.

Source

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

Return this Array raised to the power of other.

Source

pub fn round(&self) -> Self

Round this Array to the nearest integer, element-wise

Source

pub fn set(&mut self, index: &ArrayExt<u64>, other: &Array) -> Result<()>

Set the values at the specified coordinates to the corresponding values in other.

Source

pub fn set_value(&mut self, offset: usize, value: Number) -> Result<()>

Set the value at the specified coordinate to value.

Source

pub fn slice(&self, start: usize, end: usize) -> Result<Self>

Return a slice of this Array.

Source

pub fn argsort(&self, ascending: bool) -> Result<(Self, ArrayExt<u64>)>

Compute the indices needed to sort this Array.

Source

pub fn sort(&mut self, ascending: bool) -> Result<()>

Sort this Array in-place.

Source

pub fn split(&self, at: usize) -> Result<(Array, Array)>

Split this Array into two new instances at the given pivot.

Source

pub fn sin(&self) -> Array

Source

pub fn asin(&self) -> Array

Source

pub fn sinh(&self) -> Array

Source

pub fn asinh(&self) -> Array

Source

pub fn cos(&self) -> Array

Source

pub fn acos(&self) -> Array

Source

pub fn cosh(&self) -> Array

Source

pub fn acosh(&self) -> Array

Source

pub fn tan(&self) -> Array

Source

pub fn atan(&self) -> Array

Source

pub fn tanh(&self) -> Array

Source

pub fn atanh(&self) -> Array

Source

pub fn xor(&self, other: &Array) -> Array

Element-wise logical xor.

Source

pub fn xor_const(&self, other: Number) -> Array

Element-wise logical xor, relative to a constant other.

Trait Implementations§

Source§

impl Add<Number> for &Array

Source§

type Output = Array

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Number) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for &Array

Source§

type Output = Array

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign<&Array> for Array

Source§

fn add_assign(&mut self, other: &Array)

Performs the += operation. Read more
Source§

impl AddAssign<Number> for Array

Source§

fn add_assign(&mut self, rhs: Number)

Performs the += operation. Read more
Source§

impl AsType<ArrayExt<Complex<f32>>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<Complex<f32>>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<Complex<f32>>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<Complex<f32>>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<Complex<f64>>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<Complex<f64>>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<Complex<f64>>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<Complex<f64>>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<bool>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<bool>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<bool>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<bool>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<f32>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<f32>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<f32>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<f32>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<f64>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<f64>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<f64>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<f64>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<i16>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<i16>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<i16>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<i16>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<i32>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<i32>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<i32>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<i32>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<i64>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<i64>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<i64>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<i64>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<u16>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<u16>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<u16>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<u16>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<u32>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<u32>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<u32>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<u32>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<u64>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<u64>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<u64>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<u64>>

Convert this instance into an instance of T if possible.
Source§

impl AsType<ArrayExt<u8>> for Array

Source§

fn as_type(&self) -> Option<&ArrayExt<u8>>

Borrow this instance as an instance of T if possible.
Source§

fn as_type_mut(&mut self) -> Option<&mut ArrayExt<u8>>

Borrow this instance mutably as an instance of T if possible.
Source§

fn into_type(self) -> Option<ArrayExt<u8>>

Convert this instance into an instance of T if possible.
Source§

impl<T: HasAfEnum> CastFrom<Array> for ArrayExt<T>

Source§

fn cast_from(array: Array) -> ArrayExt<T>

Cast an instance of T into an instance of Self.
Source§

impl Clone for Array

Source§

fn clone(&self) -> Array

Returns a duplicate 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 Debug for Array

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Array

Source§

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

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

impl Display for Array

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<Number> for &Array

Source§

type Output = Array

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Number) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for &Array

Source§

type Output = Array

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl DivAssign<&Array> for Array

Source§

fn div_assign(&mut self, other: &Array)

Performs the /= operation. Read more
Source§

impl DivAssign<Number> for Array

Source§

fn div_assign(&mut self, rhs: Number)

Performs the /= operation. Read more
Source§

impl<T: HasAfEnum> From<&[T]> for Array
where Array: From<ArrayExt<T>>,

Source§

fn from(values: &[T]) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<Complex<f32>>> for Array

Source§

fn from(t: ArrayExt<Complex<f32>>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<Complex<f64>>> for Array

Source§

fn from(t: ArrayExt<Complex<f64>>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<bool>> for Array

Source§

fn from(t: ArrayExt<bool>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<f32>> for Array

Source§

fn from(t: ArrayExt<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<f64>> for Array

Source§

fn from(t: ArrayExt<f64>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<i16>> for Array

Source§

fn from(t: ArrayExt<i16>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<i32>> for Array

Source§

fn from(t: ArrayExt<i32>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<i64>> for Array

Source§

fn from(t: ArrayExt<i64>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<u16>> for Array

Source§

fn from(t: ArrayExt<u16>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<u32>> for Array

Source§

fn from(t: ArrayExt<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<u64>> for Array

Source§

fn from(t: ArrayExt<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<ArrayExt<u8>> for Array

Source§

fn from(t: ArrayExt<u8>) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Number>> for Array

Source§

fn from(elements: Vec<Number>) -> Self

Converts to this type from the input type.
Source§

impl<T: HasAfEnum> From<Vec<T>> for Array
where Array: From<ArrayExt<T>>,

Source§

fn from(values: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: HasAfEnum> FromIterator<T> for Array
where Array: From<ArrayExt<T>>,

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromStream for Array

Source§

type Context = ()

The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
Source§

fn from_stream<'life0, 'async_trait, D>( __arg0: (), decoder: &'life0 mut D, ) -> Pin<Box<dyn Future<Output = Result<Self, D::Error>> + Send + 'async_trait>>
where D: 'async_trait + Decoder, Self: 'async_trait, 'life0: 'async_trait,

Parse this value using the given Decoder.
Source§

impl GetSize for Array

Source§

fn get_size(&self) -> usize

Determines the total size of the object. Read more
Source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
Source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
Source§

impl<'en> IntoStream<'en> for Array

Source§

fn into_stream<E: Encoder<'en>>(self, encoder: E) -> Result<E::Ok, E::Error>

Take ownership of this value and serialize it into the given encoder.
Source§

impl Mul<Number> for &Array

Source§

type Output = Array

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Number) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for &Array

Source§

type Output = Array

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl MulAssign<&Array> for Array

Source§

fn mul_assign(&mut self, other: &Array)

Performs the *= operation. Read more
Source§

impl MulAssign<Number> for Array

Source§

fn mul_assign(&mut self, rhs: Number)

Performs the *= operation. Read more
Source§

impl PartialEq for Array

Source§

fn eq(&self, other: &Array) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Array

Source§

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

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub<Number> for &Array

Source§

type Output = Array

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Number) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for &Array

Source§

type Output = Array

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl SubAssign<&Array> for Array

Source§

fn sub_assign(&mut self, other: &Array)

Performs the -= operation. Read more
Source§

impl SubAssign<Number> for Array

Source§

fn sub_assign(&mut self, rhs: Number)

Performs the -= operation. Read more
Source§

impl<'en> ToStream<'en> for Array

Source§

fn to_stream<E: Encoder<'en>>(&'en self, encoder: E) -> Result<E::Ok, E::Error>

Serialize this value into the given encoder.

Auto Trait Implementations§

§

impl Freeze for Array

§

impl RefUnwindSafe for Array

§

impl Send for Array

§

impl Sync for Array

§

impl Unpin for Array

§

impl UnwindSafe for Array

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<F, T> CastFrom<F> for T
where T: From<F>,

Source§

fn cast_from(f: F) -> T

Cast an instance of T into an instance of Self.
Source§

impl<T, F> CastInto<F> for T
where F: CastFrom<T>,

Source§

fn cast_into(self) -> F

Cast an instance of Self into an instance of T.
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<F> Match for F

Source§

fn matches<T>(&self) -> bool
where T: TryCastFrom<Self>,

Returns true if self can be cast into the target type T.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<F, T> TryCastFrom<F> for T
where T: CastFrom<F>,

Source§

fn can_cast_from(_: &F) -> bool

Test if value can be cast into Self.
Source§

fn opt_cast_from(f: F) -> Option<T>

Returns Some(Self) if the source value can be cast into Self, otherwise None.
Source§

fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err>
where OnErr: FnOnce(&T) -> Err,

Returns Ok(Self) if the source value can be cast into Self, otherwise calls on_err.
Source§

impl<F, T> TryCastInto<T> for F
where T: TryCastFrom<F>,

Source§

fn can_cast_into(&self) -> bool

Test if self can be cast into T.
Source§

fn opt_cast_into(self) -> Option<T>

Returns Some(T) if self can be cast into T, otherwise None.
Source§

fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>
where OnErr: FnOnce(&Self) -> Err,

Returns Ok(T) if self can be cast into T, otherwise calls on_err.
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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,