source: git/factory/int_pp.h @ 1e4b53

spielwiese
Last change on this file since 1e4b53 was a52291, checked in by Martin Lee <martinlee84@…>, 12 years ago
replacing MP_INT by mpz_t Conflicts: factory/cf_factory.h
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
3
4#ifndef INCL_INT_PP_H
5#define INCL_INT_PP_H
6
7// #include "config.h"
8
9#include <factory/cf_gmp.h>
10
11#ifndef NOSTREAMIO
12#ifdef HAVE_IOSTREAM
13#include <iostream>
14#define OSTREAM std::ostream
15#elif defined(HAVE_IOSTREAM_H)
16#include <iostream.h>
17#define OSTREAM ostream
18#endif
19#endif /* NOSTREAMIO */
20
21#include "cf_assert.h"
22
23#include "int_cf.h"
24
25
26class InternalPrimePower : public InternalCF
27{
28private:
29    mpz_t thempi;
30    static int initialized;
31    static int prime;
32    static int exp;
33    static mpz_t primepow;
34    static mpz_t primepowhalf;
35    static int initialize();
36    static mpz_ptr MPI( const InternalCF * const c );
37public:
38    InternalPrimePower();
39    InternalPrimePower( const InternalCF& )
40    {
41        ASSERT( 0, "ups there is something wrong in your code" );
42    }
43    InternalPrimePower( const int i );
44    InternalPrimePower( const char * str, const int base=10 );
45    InternalPrimePower( const mpz_ptr );
46    ~InternalPrimePower();
47    InternalCF* deepCopyObject() const;
48    const char * classname() const { return "InternalPrimePower"; }
49#ifndef NOSTREAMIO
50    void print( OSTREAM&, char* );
51#endif /* NOSTREAMIO */
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* );
71    InternalCF* mulsame( InternalCF* );
72    InternalCF* dividesame( InternalCF* );
73    InternalCF* modulosame( InternalCF* );
74    InternalCF* divsame( InternalCF* );
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 );
83    InternalCF* mulcoeff( InternalCF* );
84    InternalCF* dividecoeff( InternalCF*, bool );
85    InternalCF* modulocoeff( InternalCF*, bool );
86    InternalCF* divcoeff( InternalCF*, bool );
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;
96    friend mpz_ptr getmpi ( InternalCF * value, bool symmetric );
97};
98
99inline mpz_ptr InternalPrimePower::MPI( const InternalCF * const c )
100{
101    return (((InternalPrimePower*)c)->thempi);
102}
103
104#endif /* ! INCL_INT_PP_H */
Note: See TracBrowser for help on using the repository browser.