1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id: int_int.h,v 1.4 1997-06-19 12:22:44 schmidt Exp $ */ |
---|
3 | |
---|
4 | #ifndef INCL_INT_INT_H |
---|
5 | #define INCL_INT_INT_H |
---|
6 | |
---|
7 | #include <config.h> |
---|
8 | |
---|
9 | #include "cf_gmp.h" |
---|
10 | #ifndef NOSTREAMIO |
---|
11 | #include <iostream.h> |
---|
12 | #endif /* NOSTREAMIO */ |
---|
13 | |
---|
14 | #include "assert.h" |
---|
15 | |
---|
16 | #include "int_cf.h" |
---|
17 | |
---|
18 | class InternalInteger : public InternalCF |
---|
19 | { |
---|
20 | private: |
---|
21 | MP_INT thempi; |
---|
22 | static int initialized; |
---|
23 | static MP_INT & MPI( const InternalCF * const c ); |
---|
24 | public: |
---|
25 | InternalInteger(); |
---|
26 | InternalInteger( const InternalCF& ) |
---|
27 | { |
---|
28 | ASSERT( 0, "ups there is something wrong in your code" ); |
---|
29 | } |
---|
30 | InternalInteger( const int i ); |
---|
31 | InternalInteger( const char * str ); |
---|
32 | InternalInteger( const MP_INT & ); |
---|
33 | ~InternalInteger(); |
---|
34 | InternalCF* deepCopyObject() const; |
---|
35 | const char * const classname() const { return "InternalInteger"; } |
---|
36 | #ifndef NOSTREAMIO |
---|
37 | void print( ostream&, char* ); |
---|
38 | #endif /* NOSTREAMIO */ |
---|
39 | bool isZero() const; |
---|
40 | bool isOne() const; |
---|
41 | InternalCF* genZero(); |
---|
42 | InternalCF* genOne(); |
---|
43 | |
---|
44 | bool is_imm() const; |
---|
45 | |
---|
46 | int levelcoeff() const { return IntegerDomain; } |
---|
47 | InternalCF* neg(); |
---|
48 | |
---|
49 | int comparesame( InternalCF* ); |
---|
50 | |
---|
51 | InternalCF* addsame( InternalCF* ); |
---|
52 | InternalCF* subsame( InternalCF* ); |
---|
53 | InternalCF* mulsame( InternalCF* ); |
---|
54 | InternalCF* dividesame( InternalCF* ); |
---|
55 | InternalCF* modulosame( InternalCF* ); |
---|
56 | InternalCF* divsame( InternalCF* ); |
---|
57 | InternalCF* modsame( InternalCF* ); |
---|
58 | void divremsame( InternalCF*, InternalCF*&, InternalCF*& ); |
---|
59 | bool divremsamet( InternalCF*, InternalCF*&, InternalCF*& ); |
---|
60 | |
---|
61 | int comparecoeff( InternalCF* ); |
---|
62 | |
---|
63 | InternalCF* addcoeff( InternalCF* ); |
---|
64 | InternalCF* subcoeff( InternalCF*, bool ); |
---|
65 | InternalCF* mulcoeff( InternalCF* ); |
---|
66 | InternalCF* dividecoeff( InternalCF*, bool ); |
---|
67 | InternalCF* modulocoeff( InternalCF*, bool ); |
---|
68 | InternalCF* divcoeff( InternalCF*, bool ); |
---|
69 | InternalCF* modcoeff( InternalCF*, bool ); |
---|
70 | void divremcoeff( InternalCF*, InternalCF*&, InternalCF*&, bool ); |
---|
71 | bool divremcoefft( InternalCF*, InternalCF*&, InternalCF*&, bool ); |
---|
72 | |
---|
73 | int intval() const; |
---|
74 | |
---|
75 | int intmod( int p ) const; |
---|
76 | |
---|
77 | int sign() const; |
---|
78 | |
---|
79 | InternalCF* sqrt(); |
---|
80 | |
---|
81 | friend class InternalRational; |
---|
82 | #ifdef SINGULAR |
---|
83 | friend MP_INT gmp_numerator ( const CanonicalForm & f ); |
---|
84 | friend MP_INT gmp_denominator ( const CanonicalForm & f ); |
---|
85 | #endif /* SINGULAR */ |
---|
86 | friend MP_INT getmpi ( InternalCF * value, bool symmetric ); |
---|
87 | }; |
---|
88 | |
---|
89 | inline MP_INT & InternalInteger::MPI( const InternalCF * const c ) |
---|
90 | { |
---|
91 | return (((InternalInteger*)c)->thempi); |
---|
92 | } |
---|
93 | |
---|
94 | #endif /* ! INCL_INT_INT_H */ |
---|