6 #include "../ExpressionTree/ExpressionTree.hpp" 18 template <
class Derived>
35 virtual bool isZero()
const = 0;
40 virtual void zero() = 0;
47 virtual bool isOne()
const = 0;
52 virtual void one() = 0;
59 virtual Derived
unitCanonical(Derived* u = NULL, Derived* v = NULL)
const = 0;
64 virtual Derived&
operator= (
const Derived&) = 0;
69 virtual Derived
operator+ (
const Derived&)
const = 0;
74 virtual Derived&
operator+= (
const Derived&) =0;
79 virtual Derived
operator- (
const Derived&)
const = 0;
84 virtual Derived&
operator-= (
const Derived&) = 0;
94 virtual Derived
operator* (
const Derived&)
const = 0;
99 virtual Derived&
operator*= (
const Derived&) = 0;
104 virtual Derived
operator^ (
long long int e)
const = 0;
109 virtual Derived&
operator^= (
long long int e) = 0;
116 virtual bool operator== (
const Derived&)
const = 0;
123 virtual bool operator!= (
const Derived&)
const = 0;
131 virtual void print(std::ostream& ostream)
const {
145 std::stringstream ss;
155 friend std::ostream&
operator<< (std::ostream& ostream,
const Derived& d) {
160 friend std::ostream&
operator<< (std::ostream& ostream, Derived&& d) {
An abstract class defining the interface of a commutative ring.
Definition: BPASRing.hpp:19
virtual bool operator==(const Derived &) const =0
Equality test,.
virtual bool operator!=(const Derived &) const =0
Inequality test,.
virtual Derived & operator-=(const Derived &)=0
Subtraction assignment.
virtual std::string toString() const
Convert the Ring element to a string.
Definition: BPASRing.hpp:144
virtual void zero()=0
Make *this ring element zero.
friend std::ostream & operator<<(std::ostream &ostream, const Derived &d)
Output operator.
Definition: BPASRing.hpp:155
std::string toString() const
Convert *this to a generic string representation.
virtual Derived & operator=(const Derived &)=0
Copy assignment.
virtual Derived operator^(long long int e) const =0
Exponentiation.
virtual ExpressionTree convertToExpressionTree() const =0
Convert this to an expression tree.
virtual void one()=0
Make *this ring element one.
virtual Derived & operator^=(long long int e)=0
Exponentiation assignment.
virtual Derived & operator+=(const Derived &)=0
Addition assignment.
virtual Derived operator*(const Derived &) const =0
Multiplication.
virtual mpz_class getCharacteristic() const
The characteristic of this ring class.
Definition: BPASRing.hpp:26
virtual Derived & operator*=(const Derived &)=0
Multiplication assignment.
virtual Derived unitCanonical(Derived *u=NULL, Derived *v=NULL) const =0
Obtain the unit normal (a.k.a canonical associate) of an element.
virtual Derived operator-() const =0
Negation.
virtual bool isOne() const =0
Determine if *this ring element is one, that is the multiplication identity.
An interface defining conversion of a class to an ExpressionTree.
Definition: ExpressionTree.hpp:195
virtual bool isZero() const =0
Determine if *this ring element is zero, that is the additive identity.
virtual Derived operator+(const Derived &) const =0
Addition.
virtual void print(std::ostream &ostream) const
Print the Ring element.
Definition: BPASRing.hpp:131