[][src]Trait abstalg::EuclideanDomain

pub trait EuclideanDomain: IntegralDomain {
    fn quo_rem(
        &self,
        elem1: &Self::Elem,
        elem2: &Self::Elem
    ) -> (Self::Elem, Self::Elem);
fn associate_repr(&self, elem: &Self::Elem) -> (Self::Elem, Self::Elem); fn quo(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem { ... }
fn rem(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem { ... }
fn is_multiple_of(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool { ... }
fn is_reduced(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool { ... }
fn are_associates(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool { ... }
fn is_unit(&self, elem: &Self::Elem) -> bool { ... }
fn gcd(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem { ... }
fn lcm(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem { ... }
fn extended_gcd(
        &self,
        elem1: &Self::Elem,
        elem2: &Self::Elem
    ) -> (Self::Elem, Self::Elem, Self::Elem) { ... }
fn are_relative_primes(
        &self,
        elem1: &Self::Elem,
        elem2: &Self::Elem
    ) -> bool { ... } }

An Euclidean domain is an integral domain where the Euclidean algorithm can be implemented. Typical examples are the rings of integers and polynomials.

Required methods

fn quo_rem(
    &self,
    elem1: &Self::Elem,
    elem2: &Self::Elem
) -> (Self::Elem, Self::Elem)

Performs the euclidean division algorithm dividing the first elem with the second one and returning the quotient and the remainder. The remainder should be the one with the least norm among all possible ones so that the Euclidean algorithm runs fast. The second element may be zero, in which case the quotient shall be zero and the remainder be the first element.

fn associate_repr(&self, elem: &Self::Elem) -> (Self::Elem, Self::Elem)

We assume, that among all the associates of the given elem there must be a well defined unique one (non-negative for integers, zero or monoic for polynomials). This method returns that representative and the unit element whose product with the given element is the representative.

Loading content...

Provided methods

fn quo(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem

Performs the division just like the quo_rem method would do and returns the quotient.

fn rem(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem

Performs the division just like the quo_rem method would do and returns the remainder

fn is_multiple_of(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool

Returns true if the first element is a multiple of the second one, that is the remainder is zero.

fn is_reduced(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool

Returns true if the quotient is zero, that is the first element equals is own remainder when divided by the second one.

fn are_associates(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool

Returns true if the two elements are associated (divide each other)

fn is_unit(&self, elem: &Self::Elem) -> bool

Returns true if the given element has a multiplicative inverse, that is, it is a divisor of the identity element.

fn gcd(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem

Calculates the greatest common divisor of two elements using the Euclidean algorithm.

fn lcm(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem

Calculates the lest common divisor of the two elements.

fn extended_gcd(
    &self,
    elem1: &Self::Elem,
    elem2: &Self::Elem
) -> (Self::Elem, Self::Elem, Self::Elem)

Performs the extended Euclidean algorithm which returns the greatest common divisor, and two elements that multiplied with the inputs gives the greatest common divisor.

fn are_relative_primes(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool

Checks if the given two elements are relative prime.

Loading content...

Implementors

impl EuclideanDomain for Integers[src]

impl<E> EuclideanDomain for ApproxFloats<E> where
    E: Float + Debug + Zero + One
[src]

impl<E> EuclideanDomain for CheckedInts<E> where
    E: PrimInt + Signed + Debug + From<i8>, 
[src]

impl<F> EuclideanDomain for Polynomials<F> where
    F: Field
[src]

impl<R: EuclideanDomain> EuclideanDomain for QuotientField<R>[src]

Loading content...