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