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
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>)
Implementations
sourceimpl Array
impl Array
sourcepub fn type_cast<T: HasAfEnum>(&self) -> ArrayExt<T>
pub fn type_cast<T: HasAfEnum>(&self) -> ArrayExt<T>
Cast the values of this array into an ArrayExt<T>
.
sourcepub fn concatenate(left: &Array, right: &Array) -> Array
pub fn concatenate(left: &Array, right: &Array) -> Array
Concatenate two Array
s.
sourcepub fn constant(value: Number, length: usize) -> Array
pub fn constant(value: Number, length: usize) -> Array
Construct a new Array
with the given constant value and length.
sourcepub fn random_normal(dtype: FloatType, length: usize) -> Array
pub fn random_normal(dtype: FloatType, length: usize) -> Array
Construct a new Array
with a random normal distribution.
sourcepub fn random_uniform(dtype: FloatType, length: usize) -> Array
pub fn random_uniform(dtype: FloatType, length: usize) -> Array
Construct a new Array
with a uniform random distribution.
sourcepub fn dtype(&self) -> NumberType
pub fn dtype(&self) -> NumberType
The NumberType
of this Array
.
sourcepub fn cast_into(&self, dtype: NumberType) -> Array
pub fn cast_into(&self, dtype: NumberType) -> Array
Cast into an Array
of a different NumberType
.
sourcepub fn and_const(&self, other: Number) -> Array
pub fn and_const(&self, other: Number) -> Array
Element-wise logical and, relative to a constant other
.
sourcepub fn is_infinite(&self) -> Array
pub fn is_infinite(&self) -> Array
Element-wise check for infinite values.
sourcepub fn log(&self, base: &Array) -> Array
pub fn log(&self, base: &Array) -> Array
Compute the logarithm of this Array
with respect to the given base
.
sourcepub fn log_const(&self, base: Number) -> Array
pub fn log_const(&self, base: Number) -> Array
Compute the logarithm of this Array
with respect to the given constant base
.
sourcepub fn or_const(&self, other: Number) -> Array
pub fn or_const(&self, other: Number) -> Array
Element-wise logical or, relative to a constant other
.
sourcepub fn reduce_max(&self, stride: u64) -> Result<Array>
pub fn reduce_max(&self, stride: u64) -> Result<Array>
Find the maximum value of each stride
of this Array
sourcepub fn reduce_min(&self, stride: u64) -> Result<Array>
pub fn reduce_min(&self, stride: u64) -> Result<Array>
Find the maximum value of each stride
of this Array
sourcepub fn reduce_product(&self, stride: u64) -> Result<Array>
pub fn reduce_product(&self, stride: u64) -> Result<Array>
Compute the product of each stride
of this Array
sourcepub fn reduce_sum(&self, stride: u64) -> Result<Array>
pub fn reduce_sum(&self, stride: u64) -> Result<Array>
Compute the sum of each stride
of a single block
sourcepub fn set(&mut self, index: &ArrayExt<u64>, other: &Array) -> Result<()>
pub fn set(&mut self, index: &ArrayExt<u64>, other: &Array) -> Result<()>
Set the values at the specified coordinates to the corresponding values in other
.
sourcepub fn set_value(&mut self, offset: usize, value: Number) -> Result<()>
pub fn set_value(&mut self, offset: usize, value: Number) -> Result<()>
Set the value at the specified coordinate to value
.
sourcepub fn argsort(&self, ascending: bool) -> Result<(Self, ArrayExt<u64>)>
pub fn argsort(&self, ascending: bool) -> Result<(Self, ArrayExt<u64>)>
Compute the indices needed to sort this Array
.
sourcepub fn split(&self, at: usize) -> Result<(Array, Array)>
pub fn split(&self, at: usize) -> Result<(Array, Array)>
Split this Array
into two new instances at the given pivot.
pub fn sin(&self) -> Array
pub fn asin(&self) -> Array
pub fn sinh(&self) -> Array
pub fn asinh(&self) -> Array
pub fn cos(&self) -> Array
pub fn acos(&self) -> Array
pub fn cosh(&self) -> Array
pub fn acosh(&self) -> Array
pub fn tan(&self) -> Array
pub fn atan(&self) -> Array
pub fn tanh(&self) -> Array
pub fn atanh(&self) -> Array
Trait Implementations
sourceimpl AddAssign<&'_ Array> for Array
impl AddAssign<&'_ Array> for Array
sourcefn add_assign(&mut self, other: &Array)
fn add_assign(&mut self, other: &Array)
Performs the +=
operation. Read more
sourceimpl AddAssign<Number> for Array
impl AddAssign<Number> for Array
sourcefn add_assign(&mut self, rhs: Number)
fn add_assign(&mut self, rhs: Number)
Performs the +=
operation. Read more
sourceimpl<'de> Deserialize<'de> for Array
impl<'de> Deserialize<'de> for Array
sourcefn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl DivAssign<&'_ Array> for Array
impl DivAssign<&'_ Array> for Array
sourcefn div_assign(&mut self, other: &Array)
fn div_assign(&mut self, other: &Array)
Performs the /=
operation. Read more
sourceimpl DivAssign<Number> for Array
impl DivAssign<Number> for Array
sourcefn div_assign(&mut self, rhs: Number)
fn div_assign(&mut self, rhs: Number)
Performs the /=
operation. Read more
sourceimpl<T: HasAfEnum> FromIterator<T> for Array where
Array: From<ArrayExt<T>>,
impl<T: HasAfEnum> FromIterator<T> for Array where
Array: From<ArrayExt<T>>,
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl FromStream for Array
impl FromStream for Array
sourceimpl<'en> IntoStream<'en> for Array
impl<'en> IntoStream<'en> for Array
sourceimpl MulAssign<&'_ Array> for Array
impl MulAssign<&'_ Array> for Array
sourcefn mul_assign(&mut self, other: &Array)
fn mul_assign(&mut self, other: &Array)
Performs the *=
operation. Read more
sourceimpl MulAssign<Number> for Array
impl MulAssign<Number> for Array
sourcefn mul_assign(&mut self, rhs: Number)
fn mul_assign(&mut self, rhs: Number)
Performs the *=
operation. Read more
sourceimpl SubAssign<&'_ Array> for Array
impl SubAssign<&'_ Array> for Array
sourcefn sub_assign(&mut self, other: &Array)
fn sub_assign(&mut self, other: &Array)
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Array
impl Send for Array
impl Sync for Array
impl Unpin for Array
impl UnwindSafe for Array
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> Match for F
impl<F> Match for F
sourcefn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
fn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
Returns true
if self
can be cast into the target type T
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
sourcefn can_cast_from(&F) -> bool
fn can_cast_from(&F) -> bool
Test if value
can be cast into Self
.
sourcefn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
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
.
sourceimpl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
sourcefn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if self
can be cast into T
.
sourcefn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns Some(T)
if self
can be cast into T
, otherwise None
.
sourcefn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
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
.