pub struct Perm {
pub fwd: Vec<u32>,
pub inv: Vec<u32>,
}Expand description
A permutation of 0..n with its inverse (invariant (P1), the
contract’s (S3)).
fwd[k] is the old index placed at new position k; inv[i] is the
new position of the old index i. The fields are public, as in the
contract; a value built by hand should be checked with
Perm::check_invariants.
Fields§
§fwd: Vec<u32>fwd[k]: the old index at new position k.
inv: Vec<u32>inv[i]: the new position of the old index i.
Implementations§
Source§impl Perm
impl Perm
Sourcepub fn from_fwd(fwd: Vec<u32>) -> Result<Self, SparseError>
pub fn from_fwd(fwd: Vec<u32>) -> Result<Self, SparseError>
The permutation whose forward array is fwd, with its inverse;
an error unless fwd is a bijection of 0..fwd.len().
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
true iff this is the identity.
Sourcepub fn check_invariants(&self) -> Result<(), SparseError>
pub fn check_invariants(&self) -> Result<(), SparseError>
Checks invariant (P1).
Trait Implementations§
impl Eq for Perm
impl StructuralPartialEq for Perm
Auto Trait Implementations§
impl Forget for Perm
impl Freeze for Perm
impl RefUnwindSafe for Perm
impl Send for Perm
impl Sync for Perm
impl Unpin for Perm
impl UnsafeUnpin for Perm
impl UnwindSafe for Perm
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