Struct modular_equations::LinEqSigned
source · [−]Expand description
Type for linear equations with unsigned modulo and signed other coefficients.
Linear modular equations are of the form ax + b = c (mod modu) where
coefficients a, b and c are signed for this type. Modulo modu
must be an unsigned type but compatible to the signed type (same byte count),
e.g. u32 if the signed type is i32, and strictly larger than one as
its value. Solve method of this type will panic if the modulo doesn’t
satisfy this requirement.
Fields
a: Sb: Sc: Smodu: TImplementations
sourceimpl<T, S> LinEqSigned<S, T> where
S: Int + SignCast<S, T>,
T: UInt + TryFrom<S>,
impl<T, S> LinEqSigned<S, T> where
S: Int + SignCast<S, T>,
T: UInt + TryFrom<S>,
sourcepub fn solve(&self) -> Option<Vec<T>>
pub fn solve(&self) -> Option<Vec<T>>
Solve linear modular equation for signed type terms.
This method will try to cast the signed coefficients to unsigned type such that after the cast they will represent the smallest nonnegative integers of their corresponding residue classes (modulo modu). If some of the casts fails, this method will panic but this should only occur for S::min_value() value of the signed type S.
After the cast to unsigned, the solve method of struct LinEq will
be called to solve the equation.
Trait Implementations
Auto Trait Implementations
impl<S, T> RefUnwindSafe for LinEqSigned<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for LinEqSigned<S, T> where
S: Send,
impl<S, T> Sync for LinEqSigned<S, T> where
S: Sync,
impl<S, T> Unpin for LinEqSigned<S, T> where
S: Unpin,
T: Unpin,
impl<S, T> UnwindSafe for LinEqSigned<S, T> where
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more