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>
impl<I: Index, N: Shape> Perm<I, N>
Sourcepub fn as_shape<M: Shape>(&self, dim: M) -> PermRef<'_, I, M>
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
Sourcepub fn into_shape<M: Shape>(self, dim: M) -> Perm<I, M>
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
Sourcepub fn new_checked(
forward: Box<[Idx<N, I>]>,
inverse: Box<[Idx<N, I>]>,
dim: N,
) -> Self
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
Sourcepub unsafe fn new_unchecked(
forward: Box<[Idx<N, I>]>,
inverse: Box<[Idx<N, I>]>,
) -> Self
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
Sourcepub fn into_arrays(self) -> (Box<[Idx<N, I>]>, Box<[Idx<N, I>]>)
pub fn into_arrays(self) -> (Box<[Idx<N, I>]>, Box<[Idx<N, I>]>)
returns the permutation as an array
Sourcepub fn into_inverse(self) -> Self
pub fn into_inverse(self) -> Self
returns the inverse permutation