31 #ifndef RCYCLOTOMI7CINTEGER_H 32 #define RCYCLOTOMI7CINTEGER_H 36 #include <pari/pari.h> 37 #include <gaol/gaol.h> 47 array< mpz_class, 3 >
iC;
50 static bool bClassInitialized;
52 static vector< vector< int > > iPowersL;
53 static array< array< array<mpq_class, 2>, 3 >, 2 > mpqRationalApproximations;
64 virtual void set(
const int& n);
92 ostream&
print( ostream& )
const;
95 virtual std::string
to_string(
const string& strFormat =
"generic",
const bool& bProtect =
false )
const;
97 interval to_interval()
const;
99 long int floor()
const;
102 static void initialize();
103 mpz_class iNorm()
const;
105 bool bIsLongInt()
const;
107 void conjugate(
unsigned int i );
109 vector< RCyclotomic7Integer > rciPrimeFactors()
const;
110 map< RCyclotomic7Integer, unsigned int > rciPrimeDecomposition()
const;
112 static void initializePrimeDecomposition();
113 static bool computePrimeDecomposition(
const unsigned int& iPrime );
128 bool operator==(
const long int& )
const;
131 static void computePrimesDecomposition_factorMinimalPolynomial( GEN& gFactors,
const unsigned int& iPrime );
132 static void computePrimesDecomposition_addFactor(
const unsigned int& iPrime,
const unsigned int& iFactorsCount,
RCyclotomic7Integer rci );
137 inline interval gaol_intervalFromMPZclass(
const mpz_class& i )
139 if( i.fits_slong_p() )
140 return interval( i.get_si() );
142 return interval( i.get_str().c_str() );
147 if( rciNum.divideByIfDivisible( &rciDenom ) )
149 if( rciNum.bIsLongInt() )
150 return sqrt( interval( -rciNum.
iC[0].get_si() ) );
152 return sqrt( rciNum.to_interval() );
155 return sqrt( rciNum.to_interval() / rciDenom.to_interval() );
158 #endif // RCYCLOTOMIC7INTEGER_H virtual void opp()
Computes the opp.
Definition: rcyclotomic7integer.cpp:476
virtual bool bIsSquareOfIvertible() const
Check whether the number is the square of an invertible element.
Definition: rcyclotomic7integer.cpp:663
virtual bool bIsGreaterOEThan(const int &n) const
Check whether *this >= n.
Definition: rcyclotomic7integer.cpp:328
virtual void add(const AlgebraicInteger *ai)
Performs the addition of *this by the parameter.
Definition: rcyclotomic7integer.cpp:492
virtual bool bIsGreaterThan(const int &n) const
Check whether *this > n.
Definition: rcyclotomic7integer.cpp:344
virtual bool bIsEqualTo(const int &n) const
Check whether *this == n.
Definition: rcyclotomic7integer.cpp:318
virtual double to_double() const
Convert to double (approximation)
Definition: rcyclotomic7integer.cpp:241
virtual std::string get_classname() const
Return the type (string)
Definition: rcyclotomic7integer.cpp:839
virtual void removeSquareFactors()
Remove all the square factors of the algebraic integer.
Definition: rcyclotomic7integer.cpp:807
RC7 and their operations.
Definition: rcyclotomic7integer.h:44
ostream & print(ostream &) const
Print the number.
Definition: rcyclotomic7integer.cpp:303
AlgebraicInteger * aiCopyToInteger(const int &n) const
Create an algebraic integer from an integer.
Definition: rcyclotomic7integer.cpp:834
virtual void gcd(const AlgebraicInteger *ai)
*this becomes the gcd of *this and the parameter
Definition: rcyclotomic7integer.cpp:583
virtual bool bIsLessOEThan(const AlgebraicInteger &ai) const
Check whether *this <= ai.
Definition: rcyclotomic7integer.cpp:357
Parent class for rational, quadratic and rc7 integers.
Definition: algebraicinteger.h:43
virtual std::string to_string(const string &strFormat="generic", const bool &bProtect=false) const
Convert to string.
Definition: rcyclotomic7integer.cpp:216
virtual void multiplyBy(const AlgebraicInteger *ai)
Performs the multiplication of *this by the parameter.
Definition: rcyclotomic7integer.cpp:501
virtual void substract(const AlgebraicInteger *ai)
Substracts the parameter from *this.
Definition: rcyclotomic7integer.cpp:483
AlgebraicInteger * copy() const
Create a copy of an algebraic integer.
Definition: rcyclotomic7integer.cpp:829
virtual bool bIsInvertible() const
Check whether the number is invertible.
Definition: rcyclotomic7integer.cpp:677
array< mpz_class, 3 > iC
Decomposition in the basis lambda_1, ..., lambda_(iDegree)
Definition: rcyclotomic7integer.h:47
virtual bool bIsLessThan(const AlgebraicInteger &ai) const
Check whether *this < ai.
Definition: rcyclotomic7integer.cpp:414
virtual bool bIsDivisbleBy(const AlgebraicInteger *ai) const
Check whether *this is divisible by the parameter.
Definition: rcyclotomic7integer.cpp:571
virtual void divideBy(const AlgebraicInteger *ai)
Performs the division of *this by the parameter Remark: we do not check that the *this is divisible b...
Definition: rcyclotomic7integer.cpp:541
Some decompositions of rational primes into RC7.