AlVin  1.0
A C++ implementation of the Vinberg's algorithm for Q, Q( sqrt(d) ) and Q( cos(2 pi / 7) )
algebraicinteger.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2014, 2015, 2016
3 Rafael Guglielmetti, rafael.guglielmetti@unifr.ch
4 */
5 
6 /*
7 This file is part of AlVin.
8 
9 CoxIter is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as
11 published by the Free Software Foundation, either version 3 of the
12 License, or (at your option) any later version.
13 
14 CoxIter is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with AlVin. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
31 #ifndef ALGEBRAICINTEGER_H
32 #define ALGEBRAICINTEGER_H
33 
34 #include <vector>
35 #include <iostream>
36 #include <string>
37 
38 #include "CoxIter/lib/math_tools.h"
39 
40 using namespace std;
41 using namespace MathTools;
42 
44 {
45  public:
46  virtual ~AlgebraicInteger();
47 
54  virtual AlgebraicInteger* aiCopyToInteger( const int& n ) const = 0;
55 
61  virtual AlgebraicInteger* copy() const = 0;
62 
67  virtual void set( const int& n ) = 0;
68 
73  virtual void set( AlgebraicInteger* ai ) = 0;
74 
78  virtual void removeSquareFactors() = 0;
79 
84  virtual bool bIsInvertible() const = 0;
85 
90  virtual bool bIsSquareOfIvertible() const = 0;
91 
96  virtual void gcd( const AlgebraicInteger* ai ) = 0;
97 
103  virtual bool bIsDivisbleBy( const AlgebraicInteger* ai ) const = 0;
104 
110  virtual void divideBy( const AlgebraicInteger *ai ) = 0;
111 
116  virtual void multiplyBy( const int& n ) = 0;
117 
122  virtual void multiplyBy( const AlgebraicInteger *ai ) = 0;
123 
128  virtual void add( const AlgebraicInteger *ai ) = 0;
129 
134  virtual void substract( const AlgebraicInteger *ai ) = 0;
135 
139  virtual void opp() = 0;
140 
144  virtual bool bIsLessThan( const int& n ) const = 0;
145 
149  virtual bool bIsLessThan( const AlgebraicInteger& ai ) const = 0;
150 
154  virtual bool bIsLessOEThan( const AlgebraicInteger& ai ) const = 0;
155 
159  virtual bool bIsGreaterThan( const int& n ) const = 0;
160 
164  virtual bool bIsGreaterOEThan( const int& n ) const = 0;
165 
169  virtual bool bIsEqualTo( const AlgebraicInteger& ai ) const = 0;
170 
174  virtual bool bIsEqualTo( const int& n ) const = 0;
175 
179  bool operator==( const AlgebraicInteger& ai ) const;
180 
184  bool operator!=( const int& n ) const;
185 
189  bool operator!=( const AlgebraicInteger& ai ) const;
190 
191  friend ostream& operator<<( ostream& , AlgebraicInteger const & );
192 
196  virtual ostream& print( ostream& ) const;
197 
203  virtual string to_string( const string& strFormat = "generic", const bool& bProtect = false ) const = 0;
204 
208  virtual double to_double() const = 0;
209 
213  virtual string get_classname() const = 0;
214 
215  private:
216  AlgebraicInteger& operator=( AlgebraicInteger const & );
217 };
218 
223 
228 
229 #endif // ALGEBRAICINTEGER_H
bool isLessThanPtrAlgebraicInteger(AlgebraicInteger *a, AlgebraicInteger *b)
Check if *a < *b.
Definition: algebraicinteger.cpp:3
bool isEqualToPtrAlgebraicInteger(AlgebraicInteger *a, AlgebraicInteger *b)
Check if *a = *b.
Definition: algebraicinteger.cpp:8
Parent class for rational, quadratic and rc7 integers.
Definition: algebraicinteger.h:43