6 #include "../ExpressionTree/ExpressionTree.hpp" 16 typedef enum RingProperty {
17 COMMUTATIVE_RING = 0x001,
18 INTEGRAL_DOMAIN = 0x003,
20 UNIQUE_FACTORIZATION_DOMAIN = 0x00f,
21 PRINICPAL_IDEAL_DOMAIN = 0x01f,
22 EUCLIDEAN_DOMAIN = 0x03f,
26 SMALL_PRIME_FIELD = 0x3ff,
33 class RingProperties {
48 RingProperties(RingProperty p);
53 RingProperties(std::vector<RingProperty> v);
58 inline bool has(RingProperty p);
64 inline bool has(
const RingProperties& p);
76 template <
class Derived>
97 virtual bool isZero()
const = 0;
102 virtual void zero() = 0;
109 virtual bool isOne()
const = 0;
114 virtual void one() = 0;
121 virtual Derived unitCanonical(Derived* u = NULL, Derived* v = NULL)
const = 0;
126 virtual Derived& operator= (
const Derived&) = 0;
131 virtual Derived operator+ (
const Derived&)
const = 0;
136 virtual Derived& operator+= (
const Derived&) =0;
141 virtual Derived operator- (
const Derived&)
const = 0;
146 virtual Derived& operator-= (
const Derived&) = 0;
151 virtual Derived operator- ()
const = 0;
156 virtual Derived operator* (
const Derived&)
const = 0;
161 virtual Derived& operator*= (
const Derived&) = 0;
166 virtual Derived operator^ (
long long int e)
const = 0;
171 virtual Derived& operator^= (
long long int e) = 0;
178 virtual bool operator== (
const Derived&)
const = 0;
185 virtual bool operator!= (
const Derived&)
const = 0;
193 virtual void print(std::ostream& ostream)
const {
194 ostream << convertToExpressionTree().toString();
207 std::stringstream ss;
217 friend std::ostream& operator<< (std::ostream& ostream,
const Derived& d) {
222 friend std::ostream& operator<< (std::ostream& ostream, Derived&& d) {
An abstract class defining the interface of a commutative ring.
Definition: BPASRing.hpp:77
virtual std::string toString() const
Convert the Ring element to a string.
Definition: BPASRing.hpp:206
static RingProperties properties
Static element describing the properties of this ring class.
Definition: BPASRing.hpp:83
virtual mpz_class characteristic()
The characteristic of this ring class.
Definition: BPASRing.hpp:88
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:193