1 | // ---------------------------------------------------------------------------- |
---|
2 | // npolygon.h |
---|
3 | // begin of file |
---|
4 | // Stephan Endrass, endrass@mathematik.uni-mainz.de |
---|
5 | // 23.7.99 |
---|
6 | // ---------------------------------------------------------------------------- |
---|
7 | |
---|
8 | #ifndef NPOLYGON_H |
---|
9 | #define NPOLYGON_H |
---|
10 | |
---|
11 | #include <kernel/GMPrat.h> |
---|
12 | |
---|
13 | // ---------------------------------------------------------------------------- |
---|
14 | // Class representing a linear form QQ^N-->QQ |
---|
15 | // ---------------------------------------------------------------------------- |
---|
16 | |
---|
17 | class linearForm |
---|
18 | { |
---|
19 | |
---|
20 | private: |
---|
21 | |
---|
22 | Rational *c; // the coefficients |
---|
23 | int N; // number of coefficients |
---|
24 | |
---|
25 | public: |
---|
26 | |
---|
27 | linearForm( ); |
---|
28 | linearForm( const linearForm& ); |
---|
29 | ~linearForm( ); |
---|
30 | |
---|
31 | linearForm & operator = ( const linearForm& ); |
---|
32 | |
---|
33 | friend int operator == ( const linearForm&,const linearForm& ); |
---|
34 | |
---|
35 | void copy_new ( int ); |
---|
36 | void copy_delete ( void ); |
---|
37 | void copy_zero ( void ); |
---|
38 | void copy_shallow ( linearForm& ); |
---|
39 | void copy_deep ( const linearForm& ); |
---|
40 | |
---|
41 | Rational weight ( poly, const ring r ) const; |
---|
42 | Rational weight_shift ( poly, const ring r ) const; |
---|
43 | Rational weight1 ( poly, const ring r ) const; |
---|
44 | Rational weight_shift1( poly, const ring r ) const; |
---|
45 | |
---|
46 | Rational pweight ( poly, const ring r ) const; |
---|
47 | |
---|
48 | int positive ( void ); |
---|
49 | |
---|
50 | #ifdef NPOLYGON_PRINT |
---|
51 | friend ostream & operator << ( ostream&,const linearForm& ); |
---|
52 | #endif |
---|
53 | |
---|
54 | friend class newtonPolygon; |
---|
55 | }; |
---|
56 | |
---|
57 | // ---------------------------------------------------------------------------- |
---|
58 | // Class representing a Newton polygon |
---|
59 | // ---------------------------------------------------------------------------- |
---|
60 | |
---|
61 | class newtonPolygon |
---|
62 | { |
---|
63 | |
---|
64 | private: |
---|
65 | |
---|
66 | linearForm *l; // the linear forms |
---|
67 | int N; // number of linear forms |
---|
68 | |
---|
69 | public: |
---|
70 | |
---|
71 | newtonPolygon( ); |
---|
72 | newtonPolygon( const newtonPolygon& ); |
---|
73 | newtonPolygon( poly, const ring r ); |
---|
74 | ~newtonPolygon( ); |
---|
75 | |
---|
76 | newtonPolygon & operator = ( const newtonPolygon& ); |
---|
77 | |
---|
78 | |
---|
79 | void copy_new ( int ); |
---|
80 | void copy_delete ( void ); |
---|
81 | void copy_zero ( void ); |
---|
82 | void copy_shallow( newtonPolygon& ); |
---|
83 | void copy_deep ( const newtonPolygon& ); |
---|
84 | |
---|
85 | void add_linearForm( const linearForm& ); |
---|
86 | |
---|
87 | Rational weight ( poly, const ring r ) const; |
---|
88 | Rational weight_shift ( poly, const ring r ) const; |
---|
89 | Rational weight1 ( poly, const ring r ) const; |
---|
90 | Rational weight_shift1( poly, const ring r ) const; |
---|
91 | |
---|
92 | //int is_sqh ( void ) const; |
---|
93 | //Rational* sqh_weights( void ) const; |
---|
94 | //int sqh_N ( void ) const; |
---|
95 | |
---|
96 | #ifdef NPOLYGON_PRINT |
---|
97 | friend ostream & operator << ( ostream&,const newtonPolygon& ); |
---|
98 | #endif |
---|
99 | }; |
---|
100 | |
---|
101 | // --------------------------------------- |
---|
102 | // inline functions for class linearForm |
---|
103 | // --------------------------------------- |
---|
104 | |
---|
105 | // ---------------------------------------------------------------------------- |
---|
106 | // Initialize with zero |
---|
107 | // ---------------------------------------------------------------------------- |
---|
108 | |
---|
109 | inline void linearForm::copy_zero( void ) |
---|
110 | { |
---|
111 | c = (Rational*)NULL; |
---|
112 | N = 0; |
---|
113 | } |
---|
114 | |
---|
115 | // ---------------------------------------------------------------------------- |
---|
116 | // Initialize shallow from another linear form |
---|
117 | // ---------------------------------------------------------------------------- |
---|
118 | |
---|
119 | inline void linearForm::copy_shallow( linearForm &l ) |
---|
120 | { |
---|
121 | c = l.c; |
---|
122 | N = l.N; |
---|
123 | } |
---|
124 | |
---|
125 | |
---|
126 | // ---------------------------------------------------------------------------- |
---|
127 | // Zero constructor |
---|
128 | // ---------------------------------------------------------------------------- |
---|
129 | |
---|
130 | inline linearForm::linearForm( ) |
---|
131 | { |
---|
132 | copy_zero( ); |
---|
133 | } |
---|
134 | |
---|
135 | |
---|
136 | // ------------------------------------------ |
---|
137 | // inline functions for class newtonPolygon |
---|
138 | // ------------------------------------------ |
---|
139 | |
---|
140 | // ---------------------------------------------------------------------------- |
---|
141 | // Initialize with zero |
---|
142 | // ---------------------------------------------------------------------------- |
---|
143 | |
---|
144 | inline void newtonPolygon::copy_zero( void ) |
---|
145 | { |
---|
146 | l = (linearForm*)NULL; |
---|
147 | N = 0; |
---|
148 | } |
---|
149 | |
---|
150 | // ---------------------------------------------------------------------------- |
---|
151 | // Initialize shallow from another Newton polygon |
---|
152 | // ---------------------------------------------------------------------------- |
---|
153 | |
---|
154 | inline void newtonPolygon::copy_shallow( newtonPolygon &np ) |
---|
155 | { |
---|
156 | l = np.l; |
---|
157 | N = np.N; |
---|
158 | } |
---|
159 | |
---|
160 | |
---|
161 | // ---------------------------------------------------------------------------- |
---|
162 | // Zero constructor |
---|
163 | // ---------------------------------------------------------------------------- |
---|
164 | |
---|
165 | inline newtonPolygon::newtonPolygon( ) |
---|
166 | { |
---|
167 | copy_zero( ); |
---|
168 | } |
---|
169 | |
---|
170 | #endif /* NPOLYGON_H */ |
---|
171 | |
---|
172 | // ---------------------------------------------------------------------------- |
---|
173 | // npolygon.h |
---|
174 | // end of file |
---|
175 | // ---------------------------------------------------------------------------- |
---|