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>(&self) -> ArrayExt<T> where
T: HasAfEnum,
pub fn type_cast<T>(&self) -> ArrayExt<T> where
T: HasAfEnum,
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 cast_into(&self, dtype: NumberType) -> Array
pub fn cast_into(&self, dtype: NumberType) -> Array
Cast into an Array
of a different NumberType
.
sourcepub fn to_vec(&self) -> Vec<Number, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn to_vec(&self) -> Vec<Number, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Copy the contents of this Array
into a new Vec
.
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, ArrayError>
pub fn reduce_max(&self, stride: u64) -> Result<Array, ArrayError>
Find the maximum value of each stride
of this Array
sourcepub fn reduce_min(&self, stride: u64) -> Result<Array, ArrayError>
pub fn reduce_min(&self, stride: u64) -> Result<Array, ArrayError>
Find the maximum value of each stride
of this Array
sourcepub fn reduce_product(&self, stride: u64) -> Result<Array, ArrayError>
pub fn reduce_product(&self, stride: u64) -> Result<Array, ArrayError>
Compute the product of each stride
of this Array
sourcepub fn reduce_sum(&self, stride: u64) -> Result<Array, ArrayError>
pub fn reduce_sum(&self, stride: u64) -> Result<Array, ArrayError>
Compute the sum of each stride
of a single block
sourcepub fn pow_const(&self, other: Number) -> Array
pub fn pow_const(&self, other: Number) -> Array
Return this Array
raised to the power of other
.
sourcepub fn set(
&mut self,
index: &ArrayExt<u64>,
other: &Array
) -> Result<(), ArrayError>
pub fn set(
&mut self,
index: &ArrayExt<u64>,
other: &Array
) -> Result<(), ArrayError>
Set the values at the specified coordinates to the corresponding values in other
.
sourcepub fn set_value(
&mut self,
offset: usize,
value: Number
) -> Result<(), ArrayError>
pub fn set_value(
&mut self,
offset: usize,
value: Number
) -> Result<(), ArrayError>
Set the value at the specified coordinate to value
.
sourcepub fn slice(&self, start: usize, end: usize) -> Result<Array, ArrayError>
pub fn slice(&self, start: usize, end: usize) -> Result<Array, ArrayError>
Return a slice of this Array
.
sourcepub fn argsort(
&self,
ascending: bool
) -> Result<(Array, ArrayExt<u64>), ArrayError>
pub fn argsort(
&self,
ascending: bool
) -> Result<(Array, ArrayExt<u64>), ArrayError>
Compute the indices needed to sort this Array
.
sourcepub fn split(&self, at: usize) -> Result<(Array, Array), ArrayError>
pub fn split(&self, at: usize) -> Result<(Array, Array), ArrayError>
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: D
) -> Result<Array, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Array, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
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> FromIterator<T> for Array where
T: HasAfEnum,
Array: From<ArrayExt<T>>,
impl<T> FromIterator<T> for Array where
T: HasAfEnum,
Array: From<ArrayExt<T>>,
sourcefn from_iter<I>(iter: I) -> Array where
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> Array where
I: IntoIterator<Item = T>,
Creates a value from an iterator. Read more
sourceimpl FromStream for Array
impl FromStream for Array
type Context = ()
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
sourcefn from_stream<'life0, 'async_trait, D>(
__arg0: (),
decoder: &'life0 mut D
) -> Pin<Box<dyn Future<Output = Result<Array, <D as Decoder>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
D: 'async_trait + Decoder,
Array: 'async_trait,
fn from_stream<'life0, 'async_trait, D>(
__arg0: (),
decoder: &'life0 mut D
) -> Pin<Box<dyn Future<Output = Result<Array, <D as Decoder>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
D: 'async_trait + Decoder,
Array: 'async_trait,
Parse this value using the given Decoder
.
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 Serialize for Array
impl Serialize for Array
sourcefn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. 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
.