sources/modules/Coefficients.cpp file

implements all classes that represent rings of coefficients

Functions

auto coeff_is_0(const int_coeff& n) -> bool
true iff n is equal to 0
auto coeff_is_0(const Q& r) -> bool
true iff n is equal to 0
template<prime P>
auto coeff_is_0(const Z_mod<P>& n) -> bool
true iff n is equal to 0
auto coeff_is_inv(const int_coeff& n) -> bool
true iff n is invertible, ie either +1 or -1
auto coeff_is_inv(const Q& r) -> bool
true iff n is invertible, ie non-zero
auto coeff_to_string(const int_coeff& i) -> std::string
converts integer to string
template<prime P>
auto coeff_to_string(const Z_mod<P>& i) -> std::string
converts the coefficient to string
auto coeff_to_string(Q r) -> std::string
converts the coefficient to string
auto continued_fraction(int p, int q) -> std::vector<int>
computes the continued fraction of $p/q$ such that all coefficients have the same sign
auto gcd(int_coeff p, int_coeff q) -> int_coeff
gcd of $p$ and $q$
auto is_id(const int_coeff& n) -> bool
true iff n is equal to +1
auto is_id(const Q& r) -> bool
true iff n is equal to +1
template<prime P>
auto is_id(const Z_mod<P>& n) -> bool
true iff n is equal to +1
auto operator!=(const Q& r1, const Q& r2) -> bool
true iff the two sides define the distinct rational numbers
auto operator*(const int_coeff& n1, const Q& r2) -> Q
left multiplication with integer
template<prime P>
auto operator*(const int_coeff& n1, const Z_mod<P>& n2) -> Z_mod<P>
left multiplication with integer
auto operator*(const Q& r1, const int_coeff& n2) -> Q
right multiplication with integer
auto operator*(const Q& r1, const Q& r2) -> Q
multiplication
template<prime P>
auto operator*(const Z_mod<P>& n1, const int_coeff& n2) -> Z_mod<P>
right multiplication with integer
template<prime P>
auto operator*(const Z_mod<P>& n1, const Z_mod<P>& n2) -> Z_mod<P>
multiplication
void operator*=(Q& r, const int_coeff& n)
multiplication assignment with scalar
void operator*=(Q& r1, const Q& r2)
multiplication assignment
template<prime P>
void operator*=(Z_mod<P>& n, const int_coeff& i)
multiplication assignment with integer
template<prime P>
void operator*=(Z_mod<P>& n1, const Z_mod<P>& n2)
multiplication assignment
auto operator+(const Q& r1, const Q& r2) -> Q
addition
template<prime P>
auto operator+(const Z_mod<P>& n1, const Z_mod<P>& n2) -> Z_mod<P>
addition
void operator+=(Q& r1, const Q& r2)
addition assignment
template<prime P>
void operator+=(Z_mod<P>& n1, const Z_mod<P>& n2)
addition assignment
auto operator-(const Q& r) -> Q
negative
template<prime P>
auto operator-(const Z_mod<P>& n) -> Z_mod<P>
negative
auto operator/(const int_coeff& n1, const Q& r2) -> Q
division; gives error if n2 is 0.
auto operator<(const Q& r1, const Q& r2) -> bool
comparison operator
auto operator<<(std::ostream& out, const Q& r) -> std::ostream&
stream ouput format for Q
template<prime P>
auto operator<<(std::ostream& out, const Z_mod<P>& n) -> std::ostream&
stream ouput format for Z_mod
auto operator==(const Q& r1, const Q& r2) -> bool
true iff both sides define the same rational number
auto which_coeff(const int_coeff& i) -> std::string
returns the string Z
auto which_coeff(const Q& r) -> std::string
returns the string Q
template<prime P>
auto which_coeff(const Z_mod<P>& n) -> std::string
returns the string Z_mod
template<prime P>
auto which_P(const Z_mod<P>& n) -> prime
returns the prime $p$