[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[341696] | 2 | /* $Id$ */ |
---|
[2dd068] | 3 | |
---|
[493c477] | 4 | #ifndef INCL_INT_PP_H |
---|
| 5 | #define INCL_INT_PP_H |
---|
[2dd068] | 6 | |
---|
[e4fe2b] | 7 | // #include "config.h" |
---|
[9d7aaa] | 8 | |
---|
[e4fe2b] | 9 | #include <factory/cf_gmp.h> |
---|
[2dd068] | 10 | |
---|
[718e670] | 11 | #ifndef NOSTREAMIO |
---|
[1dc616] | 12 | #ifdef HAVE_IOSTREAM |
---|
| 13 | #include <iostream> |
---|
[181148] | 14 | #define OSTREAM std::ostream |
---|
[1dc616] | 15 | #elif defined(HAVE_IOSTREAM_H) |
---|
[2dd068] | 16 | #include <iostream.h> |
---|
[181148] | 17 | #define OSTREAM ostream |
---|
[1dc616] | 18 | #endif |
---|
[718e670] | 19 | #endif /* NOSTREAMIO */ |
---|
| 20 | |
---|
[650f2d8] | 21 | #include "cf_assert.h" |
---|
[718e670] | 22 | |
---|
[2dd068] | 23 | #include "int_cf.h" |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | class InternalPrimePower : public InternalCF |
---|
| 27 | { |
---|
| 28 | private: |
---|
[a52291] | 29 | mpz_t thempi; |
---|
[2dd068] | 30 | static int initialized; |
---|
| 31 | static int prime; |
---|
| 32 | static int exp; |
---|
[a52291] | 33 | static mpz_t primepow; |
---|
| 34 | static mpz_t primepowhalf; |
---|
[2dd068] | 35 | static int initialize(); |
---|
[a52291] | 36 | static mpz_ptr MPI( const InternalCF * const c ); |
---|
[2dd068] | 37 | public: |
---|
| 38 | InternalPrimePower(); |
---|
| 39 | InternalPrimePower( const InternalCF& ) |
---|
| 40 | { |
---|
| 41 | ASSERT( 0, "ups there is something wrong in your code" ); |
---|
| 42 | } |
---|
| 43 | InternalPrimePower( const int i ); |
---|
[d07137] | 44 | InternalPrimePower( const char * str, const int base=10 ); |
---|
[a52291] | 45 | InternalPrimePower( const mpz_ptr ); |
---|
[2dd068] | 46 | ~InternalPrimePower(); |
---|
| 47 | InternalCF* deepCopyObject() const; |
---|
[c770dc] | 48 | const char * classname() const { return "InternalPrimePower"; } |
---|
[718e670] | 49 | #ifndef NOSTREAMIO |
---|
[181148] | 50 | void print( OSTREAM&, char* ); |
---|
[718e670] | 51 | #endif /* NOSTREAMIO */ |
---|
[2dd068] | 52 | bool isZero() const; |
---|
| 53 | bool isOne() const; |
---|
| 54 | InternalCF* genZero(); |
---|
| 55 | InternalCF* genOne(); |
---|
| 56 | InternalCF* normalize_myself(); |
---|
| 57 | |
---|
| 58 | static void setPrimePower( int p, int k ); |
---|
| 59 | static int getp(); |
---|
| 60 | static int getk(); |
---|
| 61 | |
---|
| 62 | bool is_imm() const; |
---|
| 63 | |
---|
| 64 | int levelcoeff() const { return PrimePowerDomain; } |
---|
| 65 | InternalCF* neg(); |
---|
| 66 | |
---|
| 67 | int comparesame( InternalCF* ); |
---|
| 68 | |
---|
| 69 | InternalCF* addsame( InternalCF* ); |
---|
| 70 | InternalCF* subsame( InternalCF* ); |
---|
[718e670] | 71 | InternalCF* mulsame( InternalCF* ); |
---|
[2dd068] | 72 | InternalCF* dividesame( InternalCF* ); |
---|
| 73 | InternalCF* modulosame( InternalCF* ); |
---|
[718e670] | 74 | InternalCF* divsame( InternalCF* ); |
---|
[2dd068] | 75 | InternalCF* modsame( InternalCF* ); |
---|
| 76 | void divremsame( InternalCF*, InternalCF*&, InternalCF*& ); |
---|
| 77 | bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ); |
---|
| 78 | |
---|
| 79 | int comparecoeff( InternalCF* ); |
---|
| 80 | |
---|
| 81 | InternalCF* addcoeff( InternalCF* ); |
---|
| 82 | InternalCF* subcoeff( InternalCF*, bool ); |
---|
[718e670] | 83 | InternalCF* mulcoeff( InternalCF* ); |
---|
| 84 | InternalCF* dividecoeff( InternalCF*, bool ); |
---|
| 85 | InternalCF* modulocoeff( InternalCF*, bool ); |
---|
| 86 | InternalCF* divcoeff( InternalCF*, bool ); |
---|
[2dd068] | 87 | InternalCF* modcoeff( InternalCF*, bool ); |
---|
| 88 | void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ); |
---|
| 89 | bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ); |
---|
| 90 | |
---|
| 91 | int intval() const; |
---|
| 92 | |
---|
| 93 | int intmod( int p ) const; |
---|
| 94 | |
---|
| 95 | int sign() const; |
---|
[a52291] | 96 | friend mpz_ptr getmpi ( InternalCF * value, bool symmetric ); |
---|
[2dd068] | 97 | }; |
---|
| 98 | |
---|
[a52291] | 99 | inline mpz_ptr InternalPrimePower::MPI( const InternalCF * const c ) |
---|
[2dd068] | 100 | { |
---|
| 101 | return (((InternalPrimePower*)c)->thempi); |
---|
| 102 | } |
---|
| 103 | |
---|
[493c477] | 104 | #endif /* ! INCL_INT_PP_H */ |
---|