pub struct Affine {
pub n: usize,
pub matrix: Vec<u64>,
pub translation: u64,
}Expand description
An affine map of the Boolean cube GF(2)ⁿ: x ↦ A x ⊕ b. matrix[i] is row i of A as a
coefficient bitmask over the low n bits; translation is b. It is a bijection iff A ∈ GL(n,2).
Fields§
§n: usize§matrix: Vec<u64>§translation: u64Implementations§
Source§impl Affine
impl Affine
Sourcepub fn apply(&self, x: u64) -> u64
pub fn apply(&self, x: u64) -> u64
Apply the map to a point x (low n bits): output bit i is parity(row_i · x) ⊕ b_i.
Sourcepub fn compose(&self, other: &Affine) -> Affine
pub fn compose(&self, other: &Affine) -> Affine
Composition self ∘ other: (self ∘ other)(x) = self(other(x)). The linear parts multiply over
GF(2) and the translations combine as A_self · b_other ⊕ b_self.
Sourcepub fn is_bijection(&self) -> bool
pub fn is_bijection(&self) -> bool
Whether the linear part is invertible (so the map is a bijection of the cube).
Trait Implementations§
impl Eq for Affine
impl StructuralPartialEq for Affine
Auto Trait Implementations§
impl Freeze for Affine
impl RefUnwindSafe for Affine
impl Send for Affine
impl Sync for Affine
impl Unpin for Affine
impl UnsafeUnpin for Affine
impl UnwindSafe for Affine
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