Skip to main content

DividedPatternMatrix

Struct DividedPatternMatrix 

Source
pub(crate) struct DividedPatternMatrix<const LIMBS: usize> {
    pub(super) inner: PatternMatrix<LIMBS>,
    pub k: u32,
    pub k_upper_bound: u32,
}
Expand description

Variation on PatternMatrix, where the contents of the matrix need to be divided by 2^k. The internal state represents the matrix

     true                       false
[  m00 -m01 ]               [ -m00  m01 ]
[ -m10  m11 ] / 2^k   or    [  m10 -m11 ] / 2^k

depending on whether pattern is respectively truthy or not.

Since some of the operations conditionally increase k, this struct furthermore keeps track of k_upper_bound; an upper bound on the value of k.

Fields§

§inner: PatternMatrix<LIMBS>§k: u32§k_upper_bound: u32

Implementations§

Source§

impl<const LIMBS: usize> DividedPatternMatrix<LIMBS>

Source

pub const UNIT: Self

The unit matrix.

Source

pub const fn extended_apply_to<const VEC_LIMBS: usize, const UPPER_BOUND: u32>( &self, vec: (Uint<VEC_LIMBS>, Uint<VEC_LIMBS>), ) -> (ExtendedInt<VEC_LIMBS, LIMBS>, ExtendedInt<VEC_LIMBS, LIMBS>)

Apply this matrix to a vector of Uints, returning the result as a vector of ExtendedInts.

Source

pub const fn extended_apply_to_vartime<const VEC_LIMBS: usize>( &self, vec: (Uint<VEC_LIMBS>, Uint<VEC_LIMBS>), ) -> (ExtendedInt<VEC_LIMBS, LIMBS>, ExtendedInt<VEC_LIMBS, LIMBS>)

Apply this matrix to a vector of Uints, returning the result as a vector of ExtendedInts.

Source

pub const fn mul_int_matrix<const RHS_LIMBS: usize>( &self, rhs: &DividedMatrix<LIMBS, IntMatrix<LIMBS>>, ) -> DividedMatrix<LIMBS, IntMatrix<LIMBS>>

Multiply self with rhs. Return the result as a DividedIntMatrix<LIMBS>.

Source

pub const fn conditional_swap_rows(&mut self, swap: Choice)

Swap the rows of this matrix if swap is truthy. Otherwise, do nothing.

Source

pub const fn swap_rows(&mut self)

Swap the rows of this matrix.

Source

pub const fn conditional_subtract_bottom_row_from_top( &mut self, subtract: Choice, )

Subtract the bottom row from the top if subtract is truthy. Otherwise, do nothing.

Source

pub const fn conditional_double_bottom_row(&mut self, double: Choice)

Double the bottom row of this matrix if double is truthy. Otherwise, do nothing.

Trait Implementations§

Source§

impl<const LIMBS: usize> Clone for DividedPatternMatrix<LIMBS>

Source§

fn clone(&self) -> DividedPatternMatrix<LIMBS>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const LIMBS: usize> Debug for DividedPatternMatrix<LIMBS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<const LIMBS: usize> PartialEq for DividedPatternMatrix<LIMBS>

Source§

fn eq(&self, other: &DividedPatternMatrix<LIMBS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const LIMBS: usize> Copy for DividedPatternMatrix<LIMBS>

Source§

impl<const LIMBS: usize> StructuralPartialEq for DividedPatternMatrix<LIMBS>

Auto Trait Implementations§

§

impl<const LIMBS: usize> Freeze for DividedPatternMatrix<LIMBS>

§

impl<const LIMBS: usize> RefUnwindSafe for DividedPatternMatrix<LIMBS>

§

impl<const LIMBS: usize> Send for DividedPatternMatrix<LIMBS>

§

impl<const LIMBS: usize> Sync for DividedPatternMatrix<LIMBS>

§

impl<const LIMBS: usize> Unpin for DividedPatternMatrix<LIMBS>

§

impl<const LIMBS: usize> UnsafeUnpin for DividedPatternMatrix<LIMBS>

§

impl<const LIMBS: usize> UnwindSafe for DividedPatternMatrix<LIMBS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.