pub struct LinEqSigned<S: Int, T: UInt> {
    pub a: S,
    pub b: S,
    pub c: S,
    pub modu: T,
}
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: T

Implementations

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.