PermRef

Type Alias PermRef 

Source
pub type PermRef<'a, I, N = usize> = Perm<Ref<'a, I, N>>;
Expand description

immutable permutation matrix view

Aliased Type§

#[repr(transparent)]
pub struct PermRef<'a, I, N = usize>(pub Ref<'a, I, N>);

Tuple Fields§

§0: Ref<'a, I, N>

Implementations§

Source§

impl<'a, I: Index, N: Shape> PermRef<'a, I, N>

Source

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

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

Source

pub fn new_checked( forward: &'a [Idx<N, I>], inverse: &'a [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: &'a [Idx<N, I>], inverse: &'a [Idx<N, I>], dim: N, ) -> 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 arrays(self) -> (&'a [Idx<N, I>], &'a [Idx<N, I>])

returns the permutation as an array

Source

pub fn len(&self) -> N

returns the dimension of the permutation

Source

pub fn inverse(self) -> Self

returns the inverse permutation

Source

pub fn canonicalized(self) -> PermRef<'a, I::FixedWidth, N>

cast the permutation to the fixed width index type

Source

pub fn uncanonicalized<J: Index>(self) -> PermRef<'a, J, N>

cast the permutation from the fixed width index type

Source§

impl<'a, 'N, I: Index> PermRef<'a, I, Dim<'N>>

Source

pub fn bound_arrays( self, ) -> (&'a Array<'N, Idx<Dim<'N>, I>>, &'a Array<'N, Idx<Dim<'N>, I>>)

returns the permutation as an array