6 #include "../ExpressionTree/ExpressionTree.hpp" 15 typedef enum RingProperty {
16 COMMUTATIVE_RING = 0x001,
17 INTEGRAL_DOMAIN = 0x003,
19 UNIQUE_FACTORIZATION_DOMAIN = 0x00f,
20 PRINICPAL_IDEAL_DOMAIN = 0x01f,
21 EUCLIDEAN_DOMAIN = 0x03f,
25 SMALL_PRIME_FIELD = 0x3ff,
32 class RingProperties {
47 RingProperties(RingProperty p);
52 RingProperties(std::vector<RingProperty> v);
57 inline bool has(RingProperty p);
63 inline bool has(
const RingProperties& p);
75 template <
class Derived>
96 virtual bool isZero()
const = 0;
101 virtual void zero() = 0;
108 virtual bool isOne()
const = 0;
113 virtual void one() = 0;
120 virtual Derived unitCanonical(Derived* u = NULL, Derived* v = NULL)
const = 0;
125 virtual Derived& operator= (
const Derived&) = 0;
130 virtual Derived operator+ (
const Derived&)
const = 0;
135 virtual Derived& operator+= (
const Derived&) =0;
140 virtual Derived operator- (
const Derived&)
const = 0;
145 virtual Derived& operator-= (
const Derived&) = 0;
150 virtual Derived operator- ()
const = 0;
155 virtual Derived operator* (
const Derived&)
const = 0;
160 virtual Derived& operator*= (
const Derived&) = 0;
165 virtual Derived operator^ (
long long int e)
const = 0;
170 virtual Derived& operator^= (
long long int e) = 0;
177 virtual bool operator== (
const Derived&)
const = 0;
184 virtual bool operator!= (
const Derived&)
const = 0;
192 virtual void print(std::ostream& ostream)
const {
193 ostream << convertToExpressionTree().toString();
201 friend std::ostream& operator<< (std::ostream& ostream,
const Derived& d) {
206 friend std::ostream& operator<< (std::ostream& ostream, Derived&& d) {
An abstract class defining the interface of a commutative ring.
Definition: BPASRing.hpp:76
static RingProperties properties
Static element describing the properties of this ring class.
Definition: BPASRing.hpp:82
virtual mpz_class characteristic()
The characteristic of this ring class.
Definition: BPASRing.hpp:87
An interface defining conversion of a class to an ExpressionTree.
Definition: ExpressionTree.hpp:195
virtual void print(std::ostream &ostream) const
Print the Ring element.
Definition: BPASRing.hpp:192