Struct abstalg::CheckedInts
source · [−]pub struct CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>, { /* private fields */ }
Expand description
The set of integers whose elements are stored in a primitive signed integer type. This structure is functionally equivalent to the set of all integers, but some operations are going to panic if the mathematical result cannot be represented in the primitive type. The lattice order is the normal total order, which is not bounded.
Trait Implementations
sourceimpl<E> AbelianGroup for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> AbelianGroup for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourcefn is_zero(&self, elem: &Self::Elem) -> bool
fn is_zero(&self, elem: &Self::Elem) -> bool
Checks if the given element is the additive identity of the ring.
sourcefn add(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
fn add(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
The additive sum of the given elements
sourcefn sub(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
fn sub(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
The difference of the given elements.
sourcefn times(&self, num: isize, elem: &Self::Elem) -> Self::Elem
fn times(&self, num: isize, elem: &Self::Elem) -> Self::Elem
Returns an integer multiple of the given element.
sourcefn neg_assign(&self, elem: &mut Self::Elem)
fn neg_assign(&self, elem: &mut Self::Elem)
The element is changed to its additive inverse.
sourcefn add_assign(&self, elem1: &mut Self::Elem, elem2: &Self::Elem)
fn add_assign(&self, elem1: &mut Self::Elem, elem2: &Self::Elem)
The second element is added to the first one.
sourcefn sub_assign(&self, elem1: &mut Self::Elem, elem2: &Self::Elem)
fn sub_assign(&self, elem1: &mut Self::Elem, elem2: &Self::Elem)
The second element is subtracted from the first one.
sourceimpl<E: Clone> Clone for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E: Clone> Clone for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourcefn clone(&self) -> CheckedInts<E>
fn clone(&self) -> CheckedInts<E>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<E: Debug> Debug for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E: Debug> Debug for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourceimpl<E> Domain for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> Domain for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourceimpl<E> EuclideanDomain for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> EuclideanDomain for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourcefn quo_rem(
&self,
elem1: &Self::Elem,
elem2: &Self::Elem
) -> (Self::Elem, Self::Elem)
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. This method panics if the second element is zero (because there is no unique solution) Read more
sourcefn reduced(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
fn reduced(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
Returns true if the second element is zero or the first element has zero quotient by the second one. These are the representative elements of the factor ring by the principal ideal generated by the second element. Read more
sourcefn gcd(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
fn gcd(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
Calculates the greatest common divisor of two elements using the Euclidean algorithm. Read more
sourcefn lcm(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
fn lcm(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Self::Elem
Calculates the lest common divisor of the two elements.
sourcefn extended_gcd(
&self,
elem1: &Self::Elem,
elem2: &Self::Elem
) -> (Self::Elem, Self::Elem, Self::Elem)
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. Read more
sourcefn relative_primes(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
fn relative_primes(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
Checks if the given two elements are relative prime.
sourceimpl<E> IntegralDomain for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> IntegralDomain for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourcefn try_div(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Option<Self::Elem>
fn try_div(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> Option<Self::Elem>
Checks if the second element divides the first one and returns the unique quotient if it exists. This method panics if the second element is zero (because there would be no unique solution). Read more
sourcefn associate_repr(&self, elem: &Self::Elem) -> Self::Elem
fn associate_repr(&self, elem: &Self::Elem) -> Self::Elem
We assume, that among all associates of the given elem there is a well defined unique one (non-negative for integers, zero or monic for polynomials). This method returns that representative element. Read more
sourcefn associate_coef(&self, elem: &Self::Elem) -> Self::Elem
fn associate_coef(&self, elem: &Self::Elem) -> Self::Elem
Returns the unique invertible element which is the quotient of the associate representative and the given element. This method panics if the element is zero. Read more
sourcefn divisible(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
fn divisible(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
Checks if the first element is a multiple of (or divisible by) the second one. Read more
sourcefn associates(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
fn associates(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
Returns true if the two elements are associates (divide each other)
sourceimpl<E> Lattice for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> Lattice for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourceimpl<E> Monoid for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> Monoid for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourcefn is_one(&self, elem: &Self::Elem) -> bool
fn is_one(&self, elem: &Self::Elem) -> bool
Checks if the given element is the multiplicative identity.
sourcefn try_inv(&self, elem: &Self::Elem) -> Option<Self::Elem>
fn try_inv(&self, elem: &Self::Elem) -> Option<Self::Elem>
Calculates the multiplicative inverse of the given element if it exists.
sourcefn invertible(&self, elem: &Self::Elem) -> bool
fn invertible(&self, elem: &Self::Elem) -> bool
Returns true if the given element has a multiplicative inverse.
sourceimpl<E> PartialOrder for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> PartialOrder for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourcefn leq(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
fn leq(&self, elem1: &Self::Elem, elem2: &Self::Elem) -> bool
Returns true if the first element is less than or equal to the second one in the partial order. Read more
sourceimpl<E> Semigroup for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> Semigroup for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
sourceimpl<E> UnitaryRing for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> UnitaryRing for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
impl<E> DistributiveLattice for CheckedInts<E> where
E: PrimInt + Signed + Debug + From<i8> + TryFrom<isize>,
Auto Trait Implementations
impl<E> RefUnwindSafe for CheckedInts<E> where
E: RefUnwindSafe,
impl<E> Send for CheckedInts<E> where
E: Send,
impl<E> Sync for CheckedInts<E> where
E: Sync,
impl<E> Unpin for CheckedInts<E> where
E: Unpin,
impl<E> UnwindSafe for CheckedInts<E> where
E: 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