file
Coefficients.hdeclares all classes that represent rings of coefficients
At present, finite fields of the form are implemented for prime integers , as well as the ring of integers and the field of rational numbers.
Classes
Typedefs
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 -
template<prime P>auto coeff_is_inv(const Z_
mod<P>& n) -> 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 such that all coefficients have the same sign
-
auto gcd(int_
coeff p, int_ coeff q) -> int_ coeff - gcd of and
-
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. -
template<prime P>auto operator/(const int_
coeff& n1, const Z_ mod<P>& n2) -> Z_ mod<P> - 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