pub struct Array { /* private fields */ }Expand description
A lazily evaluated n-dimensional array.
Cloning is cheap: clones share the computation and its result. Operations record a
graph node and return immediately; values are computed on Array::eval,
crate::eval, or when read back.
Implementations§
Source§impl Array
impl Array
Sourcepub fn from_slice<T: Element>(data: &[T], shape: &[usize]) -> Result<Self>
pub fn from_slice<T: Element>(data: &[T], shape: &[usize]) -> Result<Self>
An array holding data with the given shape.
Fails with Error::SizeMismatch if data.len() is not the shape’s element count.
Sourcepub fn full<T: Element>(shape: &[usize], value: T) -> Result<Self>
pub fn full<T: Element>(shape: &[usize], value: T) -> Result<Self>
An array of the given shape with every element set to value.
Sourcepub fn is_evaluated(&self) -> bool
pub fn is_evaluated(&self) -> bool
Whether the array has been evaluated (successfully or not).
Sourcepub fn primitive(&self) -> Option<Primitive>
pub fn primitive(&self) -> Option<Primitive>
The operation that produces this array, until it has been evaluated.
None for host data and evaluated arrays.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Array
impl !UnwindSafe for Array
impl Freeze for Array
impl Send for Array
impl Sync for Array
impl Unpin for Array
impl UnsafeUnpin for Array
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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