pub struct StridedArray<T> { /* private fields */ }Expand description
Owned strided multidimensional array.
Supports both column-major (Julia default) and row-major (C default) layouts.
Implementations§
Source§impl<T> StridedArray<T>
impl<T> StridedArray<T>
Sourcepub fn col_major(dims: &[usize]) -> StridedArray<T>
pub fn col_major(dims: &[usize]) -> StridedArray<T>
Create a column-major (Julia default) tensor filled with Default values.
Sourcepub fn row_major(dims: &[usize]) -> StridedArray<T>
pub fn row_major(dims: &[usize]) -> StridedArray<T>
Create a row-major (C default) tensor filled with Default values.
Sourcepub fn from_fn_col_major(
dims: &[usize],
f: impl FnMut(&[usize]) -> T,
) -> StridedArray<T>
pub fn from_fn_col_major( dims: &[usize], f: impl FnMut(&[usize]) -> T, ) -> StridedArray<T>
Create a column-major tensor with values produced by a function.
The function is called with indices in column-major iteration order.
Sourcepub fn from_fn_row_major(
dims: &[usize],
f: impl FnMut(&[usize]) -> T,
) -> StridedArray<T>
pub fn from_fn_row_major( dims: &[usize], f: impl FnMut(&[usize]) -> T, ) -> StridedArray<T>
Create a row-major tensor with values produced by a function.
The function is called with indices in row-major iteration order.
Source§impl<T> StridedArray<T>
impl<T> StridedArray<T>
Sourcepub fn from_parts(
data: Vec<T>,
dims: &[usize],
strides: &[isize],
offset: isize,
) -> Result<StridedArray<T>, StridedError>
pub fn from_parts( data: Vec<T>, dims: &[usize], strides: &[isize], offset: isize, ) -> Result<StridedArray<T>, StridedError>
Create from raw parts.
Sourcepub fn view(&self) -> StridedView<'_, T>
pub fn view(&self) -> StridedView<'_, T>
Create an immutable view over this tensor.
Sourcepub fn view_mut(&mut self) -> StridedViewMut<'_, T>
pub fn view_mut(&mut self) -> StridedViewMut<'_, T>
Create a mutable view over this tensor.
Sourcepub fn permuted(self, perm: &[usize]) -> Result<StridedArray<T>, StridedError>
pub fn permuted(self, perm: &[usize]) -> Result<StridedArray<T>, StridedError>
Permute dimensions (metadata-only reorder, no data copy).
Returns a new array with reordered dims and strides. The underlying data buffer is not touched.
Source§impl<T> StridedArray<T>where
T: Default,
impl<T> StridedArray<T>where
T: Default,
Sourcepub fn col_major_from_buffer(buf: Vec<T>, dims: &[usize]) -> StridedArray<T>
pub fn col_major_from_buffer(buf: Vec<T>, dims: &[usize]) -> StridedArray<T>
Create a column-major tensor reusing an existing buffer.
If buf has at least product(dims) elements, it is truncated and
zeroed. Otherwise a fresh buffer is allocated.
Source§impl<T> StridedArray<T>where
T: Copy,
impl<T> StridedArray<T>where
T: Copy,
Sourcepub unsafe fn col_major_uninit(dims: &[usize]) -> StridedArray<T>
pub unsafe fn col_major_uninit(dims: &[usize]) -> StridedArray<T>
Create a column-major tensor with uninitialized data.
§Safety
Caller must write every element before reading.
Sourcepub unsafe fn col_major_from_buffer_uninit(
buf: Vec<T>,
dims: &[usize],
) -> StridedArray<T>
pub unsafe fn col_major_from_buffer_uninit( buf: Vec<T>, dims: &[usize], ) -> StridedArray<T>
Reuse an existing buffer as a column-major tensor without zeroing.
§Safety
Caller must write every element before reading.
Trait Implementations§
Source§impl<T> Clone for StridedArray<T>where
T: Clone,
impl<T> Clone for StridedArray<T>where
T: Clone,
Source§fn clone(&self) -> StridedArray<T>
fn clone(&self) -> StridedArray<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for StridedArray<T>where
T: Debug,
impl<T> Debug for StridedArray<T>where
T: Debug,
Source§impl From<StridedArray<Complex<f64>>> for EinsumOperand<'static>
impl From<StridedArray<Complex<f64>>> for EinsumOperand<'static>
Source§fn from(arr: StridedArray<Complex<f64>>) -> EinsumOperand<'static>
fn from(arr: StridedArray<Complex<f64>>) -> EinsumOperand<'static>
Source§impl From<StridedArray<f64>> for EinsumOperand<'static>
impl From<StridedArray<f64>> for EinsumOperand<'static>
Source§fn from(arr: StridedArray<f64>) -> EinsumOperand<'static>
fn from(arr: StridedArray<f64>) -> EinsumOperand<'static>
Auto Trait Implementations§
impl<T> Freeze for StridedArray<T>
impl<T> RefUnwindSafe for StridedArray<T>where
T: RefUnwindSafe,
impl<T> Send for StridedArray<T>where
T: Send,
impl<T> Sync for StridedArray<T>where
T: Sync,
impl<T> Unpin for StridedArray<T>where
T: Unpin,
impl<T> UnsafeUnpin for StridedArray<T>
impl<T> UnwindSafe for StridedArray<T>where
T: 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,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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