pub(crate) struct RawXgcdOutput<const LIMBS: usize, MATRIX> {
gcd: OddUint<LIMBS>,
matrix: MATRIX,
}Expand description
Container for the raw output of the Binary XGCD algorithm.
Fields§
§gcd: OddUint<LIMBS>§matrix: MATRIXImplementations§
Source§impl<const LIMBS: usize> RawXgcdOutput<LIMBS, DividedPatternMatrix<LIMBS>>
impl<const LIMBS: usize> RawXgcdOutput<LIMBS, DividedPatternMatrix<LIMBS>>
Sourcepub(crate) const fn divide(self) -> RawXgcdOutput<LIMBS, PatternMatrix<LIMBS>>
pub(crate) const fn divide(self) -> RawXgcdOutput<LIMBS, PatternMatrix<LIMBS>>
Divide self.matrix.inner by 2^self.matrix.k, allowing us to simplify inner from a
DividedPatternMatrix to a PatternMatrix.
The performed divisions are modulo lhs/gcd and rhs/gcd to maintain the correctness of
the XGCD state.
This operation is ‘fast’ since it only applies the division to the top row of the matrix.
This is allowed since it is assumed that self.matrix * (lhs, rhs) = (gcd, 0); dividing
the bottom row of the matrix by a constant has no impact since its inner-product with the
input vector is zero.
Executes in variable time w.r.t. k_upper_bound.
Source§impl<const LIMBS: usize> RawXgcdOutput<LIMBS, PatternMatrix<LIMBS>>
impl<const LIMBS: usize> RawXgcdOutput<LIMBS, PatternMatrix<LIMBS>>
Sourcepub(crate) const fn bezout_coefficients(&self) -> (Int<LIMBS>, Int<LIMBS>)
pub(crate) const fn bezout_coefficients(&self) -> (Int<LIMBS>, Int<LIMBS>)
Obtain the bezout coefficients (x, y) such that lhs * x + rhs * y = gcd.
Auto Trait Implementations§
impl<const LIMBS: usize, MATRIX> Freeze for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: Freeze,
impl<const LIMBS: usize, MATRIX> RefUnwindSafe for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: RefUnwindSafe,
impl<const LIMBS: usize, MATRIX> Send for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: Send,
impl<const LIMBS: usize, MATRIX> Sync for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: Sync,
impl<const LIMBS: usize, MATRIX> Unpin for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: Unpin,
impl<const LIMBS: usize, MATRIX> UnsafeUnpin for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: UnsafeUnpin,
impl<const LIMBS: usize, MATRIX> UnwindSafe for RawXgcdOutput<LIMBS, MATRIX>where
MATRIX: 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