1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | |
---|
3 | #ifndef INCL_INT_PP_H |
---|
4 | #define INCL_INT_PP_H |
---|
5 | |
---|
6 | // #include "config.h" |
---|
7 | |
---|
8 | #include "factory/cf_gmp.h" |
---|
9 | |
---|
10 | #ifndef NOSTREAMIO |
---|
11 | #ifdef HAVE_IOSTREAM |
---|
12 | #include <iostream> |
---|
13 | #define OSTREAM std::ostream |
---|
14 | #elif defined(HAVE_IOSTREAM_H) |
---|
15 | #include <iostream.h> |
---|
16 | #define OSTREAM ostream |
---|
17 | #endif |
---|
18 | #endif /* NOSTREAMIO */ |
---|
19 | |
---|
20 | #include "cf_assert.h" |
---|
21 | |
---|
22 | #include "int_cf.h" |
---|
23 | |
---|
24 | |
---|
25 | class InternalPrimePower : public InternalCF |
---|
26 | { |
---|
27 | private: |
---|
28 | mpz_t thempi; |
---|
29 | STATIC_VAR bool initialized; |
---|
30 | STATIC_VAR int prime; |
---|
31 | STATIC_VAR int exp; |
---|
32 | STATIC_VAR mpz_t primepow; |
---|
33 | STATIC_VAR mpz_t primepowhalf; |
---|
34 | static void initialize(); |
---|
35 | static mpz_ptr MPI( const InternalCF * const c ); |
---|
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 ); |
---|
43 | InternalPrimePower( const char * str, const int base=10 ); |
---|
44 | InternalPrimePower( const mpz_ptr ); |
---|
45 | ~InternalPrimePower(); |
---|
46 | InternalCF* deepCopyObject() const; |
---|
47 | const char * classname() const { return "InternalPrimePower"; } |
---|
48 | #ifndef NOSTREAMIO |
---|
49 | void print( OSTREAM&, char* ); |
---|
50 | #endif /* NOSTREAMIO */ |
---|
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 | |
---|
59 | bool is_imm() const; |
---|
60 | |
---|
61 | int levelcoeff() const { return PrimePowerDomain; } |
---|
62 | InternalCF* neg(); |
---|
63 | |
---|
64 | int comparesame( InternalCF* ); |
---|
65 | |
---|
66 | InternalCF* addsame( InternalCF* ); |
---|
67 | InternalCF* subsame( InternalCF* ); |
---|
68 | InternalCF* mulsame( InternalCF* ); |
---|
69 | InternalCF* dividesame( InternalCF* ); |
---|
70 | InternalCF* modulosame( InternalCF* ); |
---|
71 | InternalCF* divsame( InternalCF* ); |
---|
72 | InternalCF* modsame( InternalCF* ); |
---|
73 | void divremsame( InternalCF*, InternalCF*&, InternalCF*& ); |
---|
74 | bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ); |
---|
75 | |
---|
76 | int comparecoeff( InternalCF* ); |
---|
77 | |
---|
78 | InternalCF* addcoeff( InternalCF* ); |
---|
79 | InternalCF* subcoeff( InternalCF*, bool ); |
---|
80 | InternalCF* mulcoeff( InternalCF* ); |
---|
81 | InternalCF* dividecoeff( InternalCF*, bool ); |
---|
82 | InternalCF* modulocoeff( InternalCF*, bool ); |
---|
83 | InternalCF* divcoeff( InternalCF*, bool ); |
---|
84 | InternalCF* modcoeff( InternalCF*, bool ); |
---|
85 | void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ); |
---|
86 | bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ); |
---|
87 | |
---|
88 | long intval() const; |
---|
89 | |
---|
90 | int intmod( int p ) const; |
---|
91 | |
---|
92 | int sign() const; |
---|
93 | friend mpz_ptr getmpi ( InternalCF * value, bool symmetric ); |
---|
94 | }; |
---|
95 | |
---|
96 | inline mpz_ptr InternalPrimePower::MPI( const InternalCF * const c ) |
---|
97 | { |
---|
98 | return (((InternalPrimePower*)c)->thempi); |
---|
99 | } |
---|
100 | |
---|
101 | #endif /* ! INCL_INT_PP_H */ |
---|