source: git/factory/int_pp.h @ 3ace5b6

spielwiese
Last change on this file since 3ace5b6 was 362fc67, checked in by Martin Lee <martinlee84@…>, 12 years ago
chg: remove $Id$
  • Property mode set to 100644
File size: 2.7 KB
Line 
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
25class InternalPrimePower : public InternalCF
26{
27private:
28    mpz_t thempi;
29    static int initialized;
30    static int prime;
31    static int exp;
32    static mpz_t primepow;
33    static mpz_t primepowhalf;
34    static int initialize();
35    static mpz_ptr MPI( const InternalCF * const c );
36public:
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    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* );
70    InternalCF* mulsame( InternalCF* );
71    InternalCF* dividesame( InternalCF* );
72    InternalCF* modulosame( InternalCF* );
73    InternalCF* divsame( InternalCF* );
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 );
82    InternalCF* mulcoeff( InternalCF* );
83    InternalCF* dividecoeff( InternalCF*, bool );
84    InternalCF* modulocoeff( InternalCF*, bool );
85    InternalCF* divcoeff( InternalCF*, bool );
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;
95    friend mpz_ptr getmpi ( InternalCF * value, bool symmetric );
96};
97
98inline mpz_ptr InternalPrimePower::MPI( const InternalCF * const c )
99{
100    return (((InternalPrimePower*)c)->thempi);
101}
102
103#endif /* ! INCL_INT_PP_H */
Note: See TracBrowser for help on using the repository browser.