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^kdepending 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: u32Implementations§
Source§impl<const LIMBS: usize> DividedPatternMatrix<LIMBS>
impl<const LIMBS: usize> DividedPatternMatrix<LIMBS>
Sourcepub 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>)
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.
Sourcepub 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>)
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.
Sourcepub const fn mul_int_matrix<const RHS_LIMBS: usize>(
&self,
rhs: &DividedMatrix<LIMBS, IntMatrix<LIMBS>>,
) -> DividedMatrix<LIMBS, IntMatrix<LIMBS>>
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>.
Sourcepub const fn conditional_swap_rows(&mut self, swap: Choice)
pub const fn conditional_swap_rows(&mut self, swap: Choice)
Swap the rows of this matrix if swap is truthy. Otherwise, do nothing.
Sourcepub const fn conditional_subtract_bottom_row_from_top(
&mut self,
subtract: Choice,
)
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.
Sourcepub const fn conditional_double_bottom_row(&mut self, double: Choice)
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>
impl<const LIMBS: usize> Clone for DividedPatternMatrix<LIMBS>
Source§fn clone(&self) -> DividedPatternMatrix<LIMBS>
fn clone(&self) -> DividedPatternMatrix<LIMBS>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more