28 #ifndef _CHAINCON_RINGZ2_H_ 29 #define _CHAINCON_RINGZ2_H_ 39 #include "chomp/system/config.h" 61 operator int ()
const;
87 (
const tZ2 &a,
const tZ2 &b,
88 tZ2 "ient,
tZ2 &remainder);
105 _n = (n & 1) ?
true :
false;
110 inline tZ2::operator int ()
const 128 throw "Trying to invert the zero element of Z_2.";
158 return std::string (
"Z_2");
167 return (static_cast<int> (n) ? 1 : 0);
175 return (static_cast<int> (n) ? 0 : 1);
192 out << static_cast<int> (n);
200 template <
class intType>
203 return (static_cast<intType> (static_cast<int> (n1)) == n2);
208 template <
class intType>
211 return (n1 == static_cast<intType> (static_cast<int> (n2)));
215 #endif // _CHAINCON_RINGZ2_H_ std::istream & operator>>(std::istream &in, tZ2 &n)
Reads an element from an input stream.
tZ2 & operator+=(const tZ2 &another)
Adds another ring element.
int delta() const
The delta function.
An element of the ring Z_2.
int_t hashkey1(const tZ2 &n)
Generates a hashing key no.
int_t hashkey2(const tZ2 &n)
Generates a hashing key no.
tZ2 & operator*=(const tZ2 &another)
Multiplies by another ring element.
static std::string ringsymbol()
Returns the symbol of the ring.
tZ2 & negate()
Negates the ring element.
void swap(tZ2 &another)
Swaps the internal data with another ring element.
bool operator==(const tZ2 &n1, const intType &n2)
Operator == for checking whether a ring element is equivalent to an integer number.
std::ostream & operator<<(std::ostream &out, const tZ2 &n)
Writes an element to an output stream.
tZ2()
Default constructor of a ring element.
bool _n
The number corresponding to the ring element.
friend bool divide(const tZ2 &a, const tZ2 &b, tZ2 "ient, tZ2 &remainder)
Performs the division with remainder in the ring.
tZ2 & invert()
Inverts the ring element.