source: git/factory/int_pp.h @ a4def5d

spielwiese
Last change on this file since a4def5d was 4c6bd3, checked in by Hans Schoenemann <hannes@…>, 4 years ago
fix: factorize in Z[x,..], w/o NTL, with -O3
  • 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 "cf_defs.h"
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_VAR bool initialized;
31    STATIC_VAR int prime;
32    STATIC_VAR int exp;
33    static void initialize();
34    static mpz_ptr MPI( const InternalCF * const c );
35public:
36    STATIC_VAR mpz_t primepow;
37    STATIC_VAR mpz_t primepowhalf;
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
60    bool is_imm() const;
61
62    int levelcoeff() const { return PrimePowerDomain; }
63    InternalCF* neg();
64
65    int comparesame( InternalCF* );
66
67    InternalCF* addsame( InternalCF* );
68    InternalCF* subsame( InternalCF* );
69    InternalCF* mulsame( InternalCF* );
70    InternalCF* dividesame( InternalCF* );
71    InternalCF* modulosame( InternalCF* );
72    InternalCF* divsame( InternalCF* );
73    InternalCF* modsame( InternalCF* );
74    void divremsame( InternalCF*, InternalCF*&, InternalCF*& );
75    bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& );
76
77    int comparecoeff( InternalCF* );
78
79    InternalCF* addcoeff( InternalCF* );
80    InternalCF* subcoeff( InternalCF*, bool );
81    InternalCF* mulcoeff( InternalCF* );
82    InternalCF* dividecoeff( InternalCF*, bool );
83    InternalCF* modulocoeff( InternalCF*, bool );
84    InternalCF* divcoeff( InternalCF*, bool );
85    InternalCF* modcoeff( InternalCF*, bool );
86    void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool );
87    bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool );
88
89    long intval() const;
90
91    int intmod( int p ) const;
92
93    int sign() const;
94    friend void getmpi ( InternalCF * value, mpz_t );
95};
96
97inline mpz_ptr InternalPrimePower::MPI( const InternalCF * const c )
98{
99    return (((InternalPrimePower*)c)->thempi);
100}
101
102#endif /* ! INCL_INT_PP_H */
Note: See TracBrowser for help on using the repository browser.