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