Perm

Type Alias Perm 

Source
pub type Perm<I, N = usize> = Perm<Own<I, N>>;
Expand description

permutation matrix

Aliased Type§

#[repr(transparent)]
pub struct Perm<I, N = usize>(pub Own<I, N>);

Tuple Fields§

§0: Own<I, N>

Implementations§

Source§

impl<I: Index, N: Shape> Perm<I, N>

Source

pub fn as_shape<M: Shape>(&self, dim: M) -> PermRef<'_, I, M>

returns the input permutation with the given shape after checking that it matches the current shape

Source

pub fn into_shape<M: Shape>(self, dim: M) -> Perm<I, M>

returns the input permutation with the given shape after checking that it matches the current shape

Source

pub fn new_checked( forward: Box<[Idx<N, I>]>, inverse: Box<[Idx<N, I>]>, dim: N, ) -> Self

creates a new permutation, by checking the validity of the inputs

§panics

the function panics if any of the following conditions are violated: forward and inverse must have the same length which must be less than or equal to I::Signed::MAX, be valid permutations, and be inverse permutations of each other

Source

pub unsafe fn new_unchecked( forward: Box<[Idx<N, I>]>, inverse: Box<[Idx<N, I>]>, ) -> Self

creates a new permutation reference, without checking the validity of the inputs

§safety

forward and inverse must have the same length which must be less than or equal to I::Signed::MAX, be valid permutations, and be inverse permutations of each other

Source

pub fn into_arrays(self) -> (Box<[Idx<N, I>]>, Box<[Idx<N, I>]>)

returns the permutation as an array

Source

pub fn len(&self) -> N

returns the dimension of the permutation

Source

pub fn into_inverse(self) -> Self

returns the inverse permutation