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