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