#[non_exhaustive]pub enum AnyArrayBase<T: AnyRawData> {
U8(ArrayBase<T::U8, IxDyn>),
U16(ArrayBase<T::U16, IxDyn>),
U32(ArrayBase<T::U32, IxDyn>),
U64(ArrayBase<T::U64, IxDyn>),
I8(ArrayBase<T::I8, IxDyn>),
I16(ArrayBase<T::I16, IxDyn>),
I32(ArrayBase<T::I32, IxDyn>),
I64(ArrayBase<T::I64, IxDyn>),
F32(ArrayBase<T::F32, IxDyn>),
F64(ArrayBase<T::F64, IxDyn>),
}
Expand description
Numeric n-dimensional arrays with dynamic shapes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
U8(ArrayBase<T::U8, IxDyn>)
U16(ArrayBase<T::U16, IxDyn>)
U32(ArrayBase<T::U32, IxDyn>)
U64(ArrayBase<T::U64, IxDyn>)
I8(ArrayBase<T::I8, IxDyn>)
I16(ArrayBase<T::I16, IxDyn>)
I32(ArrayBase<T::I32, IxDyn>)
I64(ArrayBase<T::I64, IxDyn>)
F32(ArrayBase<T::F32, IxDyn>)
F64(ArrayBase<T::F64, IxDyn>)
Implementations§
Source§impl<T: AnyRawData> AnyArrayBase<T>
impl<T: AnyRawData> AnyArrayBase<T>
Sourcepub const fn dtype(&self) -> AnyArrayDType
pub const fn dtype(&self) -> AnyArrayDType
Returns the dtype of the array.
Sourcepub const fn as_typed<U: ArrayDType>(
&self,
) -> Option<&ArrayBase<U::RawData<T>, IxDyn>>
pub const fn as_typed<U: ArrayDType>( &self, ) -> Option<&ArrayBase<U::RawData<T>, IxDyn>>
Returns the U
-typed array in Some(_)
iff the dtype of U
matches
the dtype of this array. Returns None
otherwise.
Sourcepub fn as_typed_mut<U: ArrayDType>(
&mut self,
) -> Option<&mut ArrayBase<U::RawData<T>, IxDyn>>
pub fn as_typed_mut<U: ArrayDType>( &mut self, ) -> Option<&mut ArrayBase<U::RawData<T>, IxDyn>>
Returns the U
-typed array in Some(_)
iff the dtype of U
matches
the dtype of this array. Returns None
otherwise.
Source§impl<T: AnyRawData> AnyArrayBase<T>
impl<T: AnyRawData> AnyArrayBase<T>
Sourcepub fn view(&self) -> AnyArrayView<'_>
pub fn view(&self) -> AnyArrayView<'_>
Returns a read-only view of the array.
Sourcepub fn cow(&self) -> AnyCowArray<'_>
pub fn cow(&self) -> AnyCowArray<'_>
Returns a copy-on-write view of the array.
Sourcepub fn into_owned(self) -> AnyArray
pub fn into_owned(self) -> AnyArray
Turns the array into a uniquely owned array, cloning the array elements if necessary.
Sourcepub fn as_bytes(&self) -> Cow<'_, [u8]>
pub fn as_bytes(&self) -> Cow<'_, [u8]>
Returns the array’s data as a byte slice.
If the array is contiguous and in standard order, i.e. if the element order in memory corresponds to the logical order of the array’s elements, a view of the data is returned without cloning.
Otherwise, the data is cloned and put into standard order first.
Source§impl<T: AnyRawData> AnyArrayBase<T>
impl<T: AnyRawData> AnyArrayBase<T>
Sourcepub fn view_mut(&mut self) -> AnyArrayViewMut<'_>
pub fn view_mut(&mut self) -> AnyArrayViewMut<'_>
Returns a read-write view of the array.
Sourcepub fn with_bytes_mut<O>(&mut self, with: impl FnOnce(&mut [u8]) -> O) -> O
pub fn with_bytes_mut<O>(&mut self, with: impl FnOnce(&mut [u8]) -> O) -> O
Provides access to the array’s data as a mutable byte slice.
If the array is contiguous and in standard order, i.e. if the element order in memory corresponds to the logical order of the array’s elements, a mutable view of the data is returned without cloning.
Otherwise, the data is cloned and put into standard order first, and later copied back into the array.
Sourcepub fn assign<U: AnyRawData>(
&mut self,
src: &AnyArrayBase<U>,
) -> Result<(), AnyArrayAssignError>
pub fn assign<U: AnyRawData>( &mut self, src: &AnyArrayBase<U>, ) -> Result<(), AnyArrayAssignError>
Perform an elementwise assignment to self
from src
.
§Errors
Errors with
AnyArrayAssignError::DTypeMismatch
if the dtypes ofself
andsrc
do not matchAnyArrayAssignError::ShapeMismatch
if the shapes ofself
andsrc
do not match
Source§impl AnyArrayBase<OwnedRepr<()>>
impl AnyArrayBase<OwnedRepr<()>>
Sourcepub fn zeros(dtype: AnyArrayDType, shape: &[usize]) -> Self
pub fn zeros(dtype: AnyArrayDType, shape: &[usize]) -> Self
Create an array with zeros of dtype
and shape shape
.
Sourcepub fn with_zeros_bytes<T>(
dtype: AnyArrayDType,
shape: &[usize],
with: impl FnOnce(&mut [u8]) -> T,
) -> (Self, T)
pub fn with_zeros_bytes<T>( dtype: AnyArrayDType, shape: &[usize], with: impl FnOnce(&mut [u8]) -> T, ) -> (Self, T)
Create an array with zeros of dtype
and shape shape
, and provide
mutable access to the bytes of the array.
The array is created to be contiguous and in standard order, i.e. its element order in memory corresponds to the logical order of the array’s elements.
Sourcepub fn into_cow(self) -> AnyCowArray<'static>
pub fn into_cow(self) -> AnyCowArray<'static>
Returns an owned copy-on-write array.
Trait Implementations§
Source§impl<T: AnyRawData> Clone for AnyArrayBase<T>where
T::U8: RawDataClone,
T::U16: RawDataClone,
T::U32: RawDataClone,
T::U64: RawDataClone,
T::I8: RawDataClone,
T::I16: RawDataClone,
T::I32: RawDataClone,
T::I64: RawDataClone,
T::F32: RawDataClone,
T::F64: RawDataClone,
impl<T: AnyRawData> Clone for AnyArrayBase<T>where
T::U8: RawDataClone,
T::U16: RawDataClone,
T::U32: RawDataClone,
T::U64: RawDataClone,
T::I8: RawDataClone,
T::I16: RawDataClone,
T::I32: RawDataClone,
T::I64: RawDataClone,
T::F32: RawDataClone,
T::F64: RawDataClone,
Source§impl<T: AnyRawData> Debug for AnyArrayBase<T>
impl<T: AnyRawData> Debug for AnyArrayBase<T>
Source§impl<T: AnyRawData> PartialEq for AnyArrayBase<T>
impl<T: AnyRawData> PartialEq for AnyArrayBase<T>
Auto Trait Implementations§
impl<T> Freeze for AnyArrayBase<T>where
<T as AnyRawData>::U8: Freeze,
<T as AnyRawData>::U16: Freeze,
<T as AnyRawData>::U32: Freeze,
<T as AnyRawData>::U64: Freeze,
<T as AnyRawData>::I8: Freeze,
<T as AnyRawData>::I16: Freeze,
<T as AnyRawData>::I32: Freeze,
<T as AnyRawData>::I64: Freeze,
<T as AnyRawData>::F32: Freeze,
<T as AnyRawData>::F64: Freeze,
impl<T> RefUnwindSafe for AnyArrayBase<T>where
<T as AnyRawData>::U8: RefUnwindSafe,
<T as AnyRawData>::U16: RefUnwindSafe,
<T as AnyRawData>::U32: RefUnwindSafe,
<T as AnyRawData>::U64: RefUnwindSafe,
<T as AnyRawData>::I8: RefUnwindSafe,
<T as AnyRawData>::I16: RefUnwindSafe,
<T as AnyRawData>::I32: RefUnwindSafe,
<T as AnyRawData>::I64: RefUnwindSafe,
<T as AnyRawData>::F32: RefUnwindSafe,
<T as AnyRawData>::F64: RefUnwindSafe,
impl<T> Send for AnyArrayBase<T>where
<T as AnyRawData>::U8: Send + Data,
<T as AnyRawData>::U16: Send + Data,
<T as AnyRawData>::U32: Send + Data,
<T as AnyRawData>::U64: Send + Data,
<T as AnyRawData>::I8: Send + Data,
<T as AnyRawData>::I16: Send + Data,
<T as AnyRawData>::I32: Send + Data,
<T as AnyRawData>::I64: Send + Data,
<T as AnyRawData>::F32: Send + Data,
<T as AnyRawData>::F64: Send + Data,
impl<T> Sync for AnyArrayBase<T>where
<T as AnyRawData>::U8: Sync + Data,
<T as AnyRawData>::U16: Sync + Data,
<T as AnyRawData>::U32: Sync + Data,
<T as AnyRawData>::U64: Sync + Data,
<T as AnyRawData>::I8: Sync + Data,
<T as AnyRawData>::I16: Sync + Data,
<T as AnyRawData>::I32: Sync + Data,
<T as AnyRawData>::I64: Sync + Data,
<T as AnyRawData>::F32: Sync + Data,
<T as AnyRawData>::F64: Sync + Data,
impl<T> Unpin for AnyArrayBase<T>where
<T as AnyRawData>::U8: Unpin,
<T as AnyRawData>::U16: Unpin,
<T as AnyRawData>::U32: Unpin,
<T as AnyRawData>::U64: Unpin,
<T as AnyRawData>::I8: Unpin,
<T as AnyRawData>::I16: Unpin,
<T as AnyRawData>::I32: Unpin,
<T as AnyRawData>::I64: Unpin,
<T as AnyRawData>::F32: Unpin,
<T as AnyRawData>::F64: Unpin,
impl<T> UnwindSafe for AnyArrayBase<T>where
<T as AnyRawData>::U8: UnwindSafe,
<T as AnyRawData>::U16: UnwindSafe,
<T as AnyRawData>::U32: UnwindSafe,
<T as AnyRawData>::U64: UnwindSafe,
<T as AnyRawData>::I8: UnwindSafe,
<T as AnyRawData>::I16: UnwindSafe,
<T as AnyRawData>::I32: UnwindSafe,
<T as AnyRawData>::I64: UnwindSafe,
<T as AnyRawData>::F32: UnwindSafe,
<T as AnyRawData>::F64: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more