Struct afarray::Coords [−][src]
pub struct Coords { /* fields omitted */ }Expand description
A hardware-accelerated set of n-dimensional coordinates, all with the same dimension.
Implementations
Constructs Coords with the given size full of zeros (origin points) for the given shape.
Panics: if shape is empty
Constructs a new Coords from an ArrayExt of offsets with respect to the given shape.
Panics: if shape is empty
Constructs a new Coords from a [TryStream] of Coords.
Panics: if any Coord has a length other than ndim
Return true if the number of coordinates in these Coords is zero.
Return true if these Coords are in sorted order with respect to the given shape.
Return a copy of these Coords without the specified axis.
Panics: if there is no dimension at axis
Return a copy of these Coords with a new dimension at the given axis.
Panics: if axis is greater than self.ndim()
Transform the coordinate basis of these Coords from a source tensor to a slice.
Transpose these Coords according to the given permutation.
If no permutation is given, the coordinate axes will be inverted.
Invert the given broadcast of these Coords.
Panics: if source_shape and broadcast are not the same length.
Transform the coordinate basis of these Coords from a slice to a source tensor.
Panics: if source_shape.len() - self.ndim() does not match elided.len()
Construct a new Coords from the selected indices.
Panics: if any index is out of bounds
Update these Coords by writing the given value at the given index.
Panics: if any index is out of bounds, or if value.len() does not match self.len()
Return these Coords as Offsets with respect to the given shape.
Panics: if shape.len() does not equal self.ndim()
Return a list of Coords from these Coords.
Panics: if the given number of dimensions does not fit the set of coordinates
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Coords
impl UnwindSafe for Coords
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns true if self can be cast into the target type T.
Test if value can be cast into Self.
Returns Some(Self) if the source value can be cast into Self, otherwise None.
fn 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.
Test if self can be cast into T.
Returns Some(T) if self can be cast into T, otherwise None.
fn 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.