Xgcd

Trait Xgcd 

Source
pub trait Xgcd<T = Self> {
    type Output;

    // Required method
    fn xgcd(&self, other: T) -> Self::Output;
}
Expand description

Is implemented by Z instances to calculate the extended gcd

Required Associated Types§

Required Methods§

Source

fn xgcd(&self, other: T) -> Self::Output

Outputs the extended greatest common divisor (xgcd) of the two given values, i.e. a triple (gcd(a, b), x, y), where a*x + b*y = gcd(a, b)*.

Parameters:

  • other: specifies one of the values of which the gcd is computed

Returns a triple (gcd(a, b), x, y) containing the greatest common divisor, x, and y s.t. gcd(a, b) = a*x + b*y.

Implementors§

Source§

impl<Integer: Into<Z>> Xgcd<Integer> for Z

Source§

type Output = (Z, Z, Z)