Struct extendr_api::prelude::perm::Perm
pub struct Perm<I>where
I: Index,{
pub(super) forward: Box<[I]>,
pub(super) inverse: Box<[I]>,
}
Expand description
Permutation matrix.
Fields§
§forward: Box<[I]>
§inverse: Box<[I]>
Implementations§
§impl<I> Perm<I>where
I: Index,
impl<I> Perm<I>where
I: Index,
pub fn new_checked(forward: Box<[I]>, inverse: Box<[I]>) -> Perm<I>
pub fn new_checked(forward: Box<[I]>, inverse: Box<[I]>) -> Perm<I>
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.
pub unsafe fn new_unchecked(forward: Box<[I]>, inverse: Box<[I]>) -> Perm<I>
pub unsafe fn new_unchecked(forward: Box<[I]>, inverse: Box<[I]>) -> Perm<I>
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.
pub fn into_arrays(self) -> (Box<[I]>, Box<[I]>)
pub fn into_arrays(self) -> (Box<[I]>, Box<[I]>)
Returns the permutation as an array.
pub fn into_inverse(self) -> Perm<I>
pub fn into_inverse(self) -> Perm<I>
Returns the inverse permutation.
Trait Implementations§
Auto Trait Implementations§
impl<I> Freeze for Perm<I>
impl<I> RefUnwindSafe for Perm<I>where
I: RefUnwindSafe,
impl<I> Send for Perm<I>
impl<I> Sync for Perm<I>
impl<I> Unpin for Perm<I>
impl<I> UnwindSafe for Perm<I>where
I: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more