source: git/kernel/test.cc @ d894371

spielwiese
Last change on this file since d894371 was d894371, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: simple tests for p_Totaldegree
  • Property mode set to 100644
File size: 5.3 KB
Line 
1#include "mod2.h"
2
3#include <omalloc/omalloc.h>
4#include <misc/auxiliary.h>
5#ifdef HAVE_FACTORY
6#include <factory/factory.h> // :(
7#endif
8
9#include <misc/intvec.h>
10#include <misc/int64vec.h>
11#include <misc/mylimits.h>
12#include <misc/options.h>
13
14#include <reporter/reporter.h>
15
16#include <resources/feFopen.h>
17#include <resources/feResource.h>
18
19#include <coeffs/coeffs.h>
20
21#include <coeffs/si_gmp.h>
22
23#include <polys/kbuckets.h>
24#include <polys/matpol.h>
25#include <polys/mod_raw.h>
26#include <polys/prCopy.h>
27#include <polys/sbuckets.h>
28#include <polys/simpleideals.h>
29#include <polys/weight.h>
30
31#include <polys/monomials/maps.h>
32#include <polys/monomials/monomials.h>
33#include <polys/monomials/p_polys.h>
34#include <polys/monomials/ring.h>
35
36#include <polys/nc/nc.h>
37#include <polys/nc/ncSACache.h>
38#include <polys/nc/ncSAFormula.h>
39#include <polys/nc/ncSAMult.h>
40#include <polys/nc/sca.h>
41#include <polys/nc/summator.h>
42
43
44#include <polys/templates/p_MemAdd.h>
45#include <polys/templates/p_Procs.h>
46
47#include <polys/operations/pShallowCopyDelete.h>
48
49#include <polys/clapsing.h>
50
51
52#ifdef HAVE_FACTORY
53// The following are needed due to FACTORY (e.g. initCanonicalForm)
54int initializeGMP(){ return 1; } 
55int mmInit(void) {return 1; }
56#endif
57
58
59#include <coeffs/numbers.h>
60
61#include "mod2.h"
62#include "structs.h"
63
64
65// HEADERS:
66#include "hutil.h"
67//#include "idrec.h" // moved to Singular
68#include "stairc.h"
69#include "ideals.h"
70#include "syz.h"
71#include "fast_maps.h"
72#include "febase.h"
73#include "walkProc.h"
74#include "walkMain.h"
75#include "walkSupport.h"
76#include "khstd.h"
77/// #include "sparsmat.h" // TODO: install polys/this!
78//+
79
80#include "fglm.h"
81#include "kstd1.h"
82#include "fglmgauss.h"
83#include "fglmvec.h"
84#include "kstdfac.h"
85#include "kmatrix.h"
86#include "GMPrat.h"
87#include "multicnt.h"
88#include "npolygon.h"
89#include "semic.h"
90#include "spectrum.h"
91#include "splist.h"
92#include "multicnt.h"
93#include "eigenval.h"
94#include "units.h"
95#include "fegetopt.h"
96#include "ratgring.h"
97#include "shiftgb.h"
98// #include "mmalloc.h" // move to Singular!?
99#include "gfan.h"
100
101#include "kutil.h"
102
103// #include "dbm_sl.h" // TODO: needs si_link// already moved to Singular/!
104
105// #include "CCRing.h" // Too old!
106#include "digitech.h"
107#include "eigenval.h"
108#include "fast_maps.h"
109#include "fast_mult.h"
110#include "febase.h"
111#include "fegetopt.h"
112
113#include "fglmgauss.h"
114#include "fglm.h"
115#include "fglmvec.h"
116
117////////#include "F5cData.h"
118#include "f5c.h"
119#include "f5data.h"
120#include "f5gb.h"
121#include "f5lists.h"
122////////#include "F5cLists.h"
123
124#include "gfan.h"
125
126
127#include "GMPrat.h"
128
129// #include "htmlhelp.h" // For Windows //
130#include "hutil.h"
131// #include "Ideal.h" // Too old?
132
133
134#include "ideals.h"
135
136#include "kmatrix.h"
137#include "kstd1.h"
138#include "kstdfac.h"
139#include "khstd.h"
140
141#include "linearAlgebra.h"
142
143
144
145// #include "lplist.h" // Too old!
146#include "multicnt.h"
147#include "npolygon.h"
148// #include "Number.h" // Too old?
149#include "page.h"
150// #include "Poly.h" // Too old?
151// #include "PowerSeries.h" // Too old?
152
153#include "preimage.h"
154
155#include "nc.h"
156
157#include "ratgring.h"
158#include "ringgb.h"
159// #include "run.h" // moved to Singular
160#include "semic.h"
161#include "shiftgb.h"
162// #include "si_gmp.h" // remove it...
163#include "spectrum.h"
164#include "splist.h"
165#include "stairc.h"
166#include "structs.h"
167#include "syz.h"
168// #include "testpoly.h" // Too old?
169
170#include "tgbgauss.h"
171#include "tgb.h"
172
173#include "timer.h"
174
175#include "units.h"
176#include "walkMain.h"
177#include "walkProc.h"
178#include "walkSupport.h"
179
180
181// #include <polys/clapconv.h> // due to factory? :(
182// #include "tgb_internal.h" // :(
183// #include "F4.h" // uses tgb_internal // :(
184// #include "IIntvec.h" // :(
185
186
187
188
189// #include "fglmzero.cc" // looks like <factory/templates/ftmpl_list.h> must be installed!
190// TODO: looks like <coeffs/mpr_complex.h> must be installed!
191
192
193
194#include "polys.h"
195
196int main( int, char *argv[] ) 
197{
198  feInitResources(argv[0]);
199
200  StringSetS("ressources in use (as reported by feStringAppendResources(0):\n");
201  feStringAppendResources(0);
202  PrintS(StringAppendS("\n"));
203
204   
205  // Libpolys tests:
206   
207  // construct the ring Z/32003[x,y,z]
208  // the variable names
209  char **n=(char**)omalloc(3*sizeof(char*));
210  n[0]=omStrDup("x");
211  n[1]=omStrDup("y");
212  n[2]=omStrDup("z2");
213
214  ring R = rDefault(32003,3,n); //  ring R = rDefault(0,3,n);
215
216  rWrite(R); PrintLn();
217
218#ifdef RDEBUG
219  rDebugPrint(R);
220#endif
221
222 
223  poly p = p_ISet(1,R); p_SetExp(p,1,1, R); p_Setm(p, R);
224
225  assume( p_GetExp(p,1, R) == 1 );
226 
227  poly pp = pp_Mult_qq( p, p, R);
228
229  Print("p: "); p_Write0(p, R); Print(", deg(p): %d", p_Totaldegree(p, R)); assume( 1 == p_Totaldegree(p, R) );
230
231  Print("; p*p : "); p_Write0(pp, R); Print("deg(pp): %d\n", p_Totaldegree(pp, R)); assume( 2 == p_Totaldegree(pp, R) );
232
233
234  p_Delete(&p, R);
235 
236  assume( p_GetExp(pp,1, R) == 2 );
237 
238  p_Delete(&pp, R);
239 
240 
241//  rDelete(R);
242   
243  // make R the default ring:
244  rChangeCurrRing(R);
245 
246  // create the polynomial 1
247  poly p1=pISet(1);
248
249  // create tthe polynomial 2*x^3*z^2
250  poly p2=p_ISet(2,R);
251  pSetExp(p2,1,3);
252  pSetExp(p2,3,2);
253  pSetm(p2);
254
255  // print p1 + p2
256  Print("p1: "); pWrite0(p1); 
257  Print(" + p2: "); pWrite0(p2); 
258  Print("  ---- >>>> ");
259
260  // compute p1+p2
261  p1=p_Add_q(p1,p2,R); p2=NULL;
262  pWrite(p1); 
263
264  // clean up:
265//  pDelete(&p1);
266   
267  rDelete(R); // should cleanup every belonging polynomial, right!?
268   
269   
270  return 0;
271}
Note: See TracBrowser for help on using the repository browser.