Trait NDArrayTransform

Source
pub trait NDArrayTransform:
    NDArray
    + Sized
    + Debug {
    type Broadcast: Access<Self::DType>;
    type Slice: Access<Self::DType>;
    type Transpose: Access<Self::DType>;

    // Required methods
    fn broadcast(
        self,
        shape: Shape,
    ) -> Result<Array<Self::DType, Self::Broadcast, Self::Platform>, Error>;
    fn reshape(self, shape: Shape) -> Result<Self, Error>;
    fn slice(
        self,
        range: Range,
    ) -> Result<Array<Self::DType, Self::Slice, Self::Platform>, Error>;
    fn squeeze(self, axes: Axes) -> Result<Self, Error>;
    fn unsqueeze(self, axes: Axes) -> Result<Self, Error>;
    fn transpose(
        self,
        permutation: Option<Axes>,
    ) -> Result<Array<Self::DType, Self::Transpose, Self::Platform>, Error>;
}
Expand description

Array transform operations

Required Associated Types§

Source

type Broadcast: Access<Self::DType>

The type returned by broadcast

Source

type Slice: Access<Self::DType>

The type returned by slice

Source

type Transpose: Access<Self::DType>

The type returned by transpose

Required Methods§

Source

fn broadcast( self, shape: Shape, ) -> Result<Array<Self::DType, Self::Broadcast, Self::Platform>, Error>

Broadcast this array into the given shape.

Source

fn reshape(self, shape: Shape) -> Result<Self, Error>

Reshape this array.

Source

fn slice( self, range: Range, ) -> Result<Array<Self::DType, Self::Slice, Self::Platform>, Error>

Construct a slice of this array.

Source

fn squeeze(self, axes: Axes) -> Result<Self, Error>

Contract the given axes of this array. This will return an error if any of the axes have dimension > 1.

Source

fn unsqueeze(self, axes: Axes) -> Result<Self, Error>

Expand the given axes of this array.

Source

fn transpose( self, permutation: Option<Axes>, ) -> Result<Array<Self::DType, Self::Transpose, Self::Platform>, Error>

Transpose this array according to the given permutation. If no permutation is given, the array axes will be reversed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§