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.

Object Safety§

This trait is not object safe.

Implementors§