1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* $Id: longalg.cc 12469 2010-01-28 10:39:49Z hannes $ */ |
---|
5 | /* |
---|
6 | * ABSTRACT: algebraic numbers |
---|
7 | */ |
---|
8 | |
---|
9 | #include <stdio.h> |
---|
10 | #include <string.h> |
---|
11 | #include <kernel/mod2.h> |
---|
12 | #include <kernel/structs.h> |
---|
13 | #include <omalloc/omalloc.h> |
---|
14 | #include <kernel/febase.h> |
---|
15 | #include <kernel/longrat.h> |
---|
16 | #include <kernel/modulop.h> |
---|
17 | #include <kernel/numbers.h> |
---|
18 | #include <kernel/polys.h> |
---|
19 | #include <kernel/ideals.h> |
---|
20 | #include <kernel/ring.h> |
---|
21 | #ifdef HAVE_FACTORY |
---|
22 | #define SI_DONT_HAVE_GLOBAL_VARS |
---|
23 | #include <factory/factory.h> |
---|
24 | #include <kernel/clapsing.h> |
---|
25 | #include <kernel/clapconv.h> |
---|
26 | #endif |
---|
27 | #include <kernel/longalg.h> |
---|
28 | #include <kernel/longtrans.h> |
---|
29 | |
---|
30 | #ifdef LDEBUG |
---|
31 | #define naTest(a) naDBTest(a,__FILE__,__LINE__) |
---|
32 | BOOLEAN naDBTest(number a, const char *f,const int l); |
---|
33 | #else |
---|
34 | #define naTest(a) |
---|
35 | #endif |
---|
36 | |
---|
37 | naIdeal naI = NULL; |
---|
38 | napoly naMinimalPoly; |
---|
39 | omBin snaIdeal_bin = omGetSpecBin(sizeof(snaIdeal)); |
---|
40 | number (*naMap)(number from); |
---|
41 | |
---|
42 | void redefineFunctionPointers() |
---|
43 | { |
---|
44 | n_Procs_s* n = currRing->cf; |
---|
45 | /* re-defining function pointers */ |
---|
46 | n->cfDelete = naDelete; |
---|
47 | n->nNormalize = naNormalize; |
---|
48 | n->cfInit = naInit; |
---|
49 | n->nPar = naPar; |
---|
50 | n->nParDeg = naParDeg; |
---|
51 | n->n_Int = naInt; |
---|
52 | n->nAdd = naAdd; |
---|
53 | n->nSub = naSub; |
---|
54 | n->nMult = naMult; |
---|
55 | n->nDiv = naDiv; |
---|
56 | n->nExactDiv = naDiv; |
---|
57 | n->nIntDiv = naIntDiv; |
---|
58 | n->nNeg = naNeg; |
---|
59 | n->nInvers = naInvers; |
---|
60 | n->nCopy = naCopy; |
---|
61 | n->cfCopy = na_Copy; |
---|
62 | n->nGreater = naGreater; |
---|
63 | n->nEqual = naEqual; |
---|
64 | n->nIsZero = naIsZero; |
---|
65 | n->nIsOne = naIsOne; |
---|
66 | n->nIsMOne = naIsMOne; |
---|
67 | n->nGreaterZero = naGreaterZero; |
---|
68 | n->cfWrite = naWrite; |
---|
69 | n->nRead = naRead; |
---|
70 | n->nPower = naPower; |
---|
71 | n->nGcd = naGcd; |
---|
72 | n->nLcm = naLcm; |
---|
73 | n->cfSetMap = naSetMap; |
---|
74 | n->nName = naName; |
---|
75 | n->nSize = naSize; |
---|
76 | n->cfGetDenom = napGetDenom; |
---|
77 | n->cfGetNumerator = napGetNumerator; |
---|
78 | #ifdef LDEBUG |
---|
79 | n->nDBTest = naDBTest; |
---|
80 | #endif |
---|
81 | /* re-defining global function pointers */ |
---|
82 | nNormalize=naNormalize; |
---|
83 | nPar = naPar; |
---|
84 | nParDeg= nParDeg; |
---|
85 | n_Int = naInt; |
---|
86 | nAdd = naAdd; |
---|
87 | nSub = naSub; |
---|
88 | nMult = naMult; |
---|
89 | nDiv = naDiv; |
---|
90 | nExactDiv= naDiv; |
---|
91 | nIntDiv= naIntDiv; |
---|
92 | nNeg = naNeg; |
---|
93 | nInvers= naInvers; |
---|
94 | nCopy = naCopy; |
---|
95 | nGreater = naGreater; |
---|
96 | nEqual = naEqual; |
---|
97 | nIsZero = naIsZero; |
---|
98 | nIsOne = naIsOne; |
---|
99 | nIsMOne = naIsMOne; |
---|
100 | nGreaterZero = naGreaterZero; |
---|
101 | nRead = naRead; |
---|
102 | nPower = naPower; |
---|
103 | nGcd = naGcd; |
---|
104 | nLcm = naLcm; |
---|
105 | nName= naName; |
---|
106 | nSize = naSize; |
---|
107 | } |
---|
108 | |
---|
109 | static number nadGcd( number a, number b, const ring r) { return nacInit(1,r); } |
---|
110 | /*2 |
---|
111 | * sets the appropriate operators |
---|
112 | */ |
---|
113 | void naSetChar(int i, ring r) |
---|
114 | { |
---|
115 | assume((r->minpoly != NULL) || |
---|
116 | (r->minideal != NULL) ); |
---|
117 | |
---|
118 | if (naI!=NULL) |
---|
119 | { |
---|
120 | int j; |
---|
121 | for (j=naI->anz-1; j>=0; j--) |
---|
122 | p_Delete (&naI->liste[j],nacRing); |
---|
123 | omFreeSize((ADDRESS)naI->liste,naI->anz*sizeof(napoly)); |
---|
124 | omFreeBin((ADDRESS)naI, snaIdeal_bin); |
---|
125 | naI=NULL; |
---|
126 | } |
---|
127 | naMap = naCopy; |
---|
128 | |
---|
129 | if (r->minpoly!=NULL) |
---|
130 | { |
---|
131 | naMinimalPoly=((lnumber)r->minpoly)->z; |
---|
132 | #ifdef LDEBUG |
---|
133 | omCheckAddr(naMinimalPoly); |
---|
134 | #endif |
---|
135 | } |
---|
136 | else |
---|
137 | naMinimalPoly = NULL; |
---|
138 | |
---|
139 | if (r->minideal!=NULL) |
---|
140 | { |
---|
141 | naI=(naIdeal)omAllocBin(snaIdeal_bin); |
---|
142 | naI->anz=IDELEMS(r->minideal); |
---|
143 | naI->liste=(napoly*)omAlloc(naI->anz*sizeof(napoly)); |
---|
144 | int j; |
---|
145 | for (j=naI->anz-1; j>=0; j--) |
---|
146 | { |
---|
147 | lnumber a = (lnumber)pGetCoeff(r->minideal->m[j]); |
---|
148 | naI->liste[j]=napCopy(a->z); |
---|
149 | } |
---|
150 | } |
---|
151 | |
---|
152 | ntNumbOfPar=rPar(r); |
---|
153 | if (i == 1) |
---|
154 | ntIsChar0 = 1; |
---|
155 | else if (i < 0) |
---|
156 | { |
---|
157 | ntIsChar0 = 0; |
---|
158 | npSetChar(-i, r->algring); // to be changed HS |
---|
159 | } |
---|
160 | #ifdef TEST |
---|
161 | else |
---|
162 | { |
---|
163 | Print("naSetChar:c=%d param=%d\n",i,rPar(r)); |
---|
164 | } |
---|
165 | #endif |
---|
166 | nacRing = r->algring; |
---|
167 | nacInit = nacRing->cf->cfInit; |
---|
168 | nacInt = nacRing->cf->n_Int; |
---|
169 | nacCopy = nacRing->cf->nCopy; |
---|
170 | nacAdd = nacRing->cf->nAdd; |
---|
171 | nacSub = nacRing->cf->nSub; |
---|
172 | nacNormalize = nacRing->cf->nNormalize; |
---|
173 | nacNeg = nacRing->cf->nNeg; |
---|
174 | nacIsZero = nacRing->cf->nIsZero; |
---|
175 | nacRead = nacRing->cf->nRead; |
---|
176 | nacGreaterZero = nacRing->cf->nGreaterZero; |
---|
177 | nacIsOne = nacRing->cf->nIsOne; |
---|
178 | nacIsMOne = nacRing->cf->nIsMOne; |
---|
179 | nacGcd = nacRing->cf->nGcd; |
---|
180 | nacLcm = nacRing->cf->nLcm; |
---|
181 | nacMult = nacRing->cf->nMult; |
---|
182 | nacDiv = nacRing->cf->nDiv; |
---|
183 | nacIntDiv = nacRing->cf->nIntDiv; |
---|
184 | nacInvers = nacRing->cf->nInvers; |
---|
185 | nacDelete = nacRing->cf->cfDelete; |
---|
186 | } |
---|
187 | |
---|
188 | /*================ procedure for rational functions: naXXXX =================*/ |
---|
189 | |
---|
190 | /*2 |
---|
191 | * z:= i |
---|
192 | */ |
---|
193 | number naInit(int i, const ring r) |
---|
194 | { |
---|
195 | if (i!=0) |
---|
196 | { |
---|
197 | number c=n_Init(i,r->algring); |
---|
198 | if (!n_IsZero(c,r->algring)) |
---|
199 | { |
---|
200 | poly z=p_Init(r->algring); |
---|
201 | pSetCoeff0(z,c); |
---|
202 | lnumber l = (lnumber)omAllocBin(rnumber_bin); |
---|
203 | l->z = z; |
---|
204 | l->s = 2; |
---|
205 | l->n = NULL; |
---|
206 | return (number)l; |
---|
207 | } |
---|
208 | } |
---|
209 | /*else*/ |
---|
210 | return NULL; |
---|
211 | } |
---|
212 | |
---|
213 | number naPar(int i) |
---|
214 | { |
---|
215 | lnumber l = (lnumber)omAllocBin(rnumber_bin); |
---|
216 | l->s = 2; |
---|
217 | l->z = p_ISet(1,nacRing); |
---|
218 | napSetExp(l->z,i,1); |
---|
219 | p_Setm(l->z,nacRing); |
---|
220 | l->n = NULL; |
---|
221 | return (number)l; |
---|
222 | } |
---|
223 | |
---|
224 | int naParDeg(number n) /* i := deg(n) */ |
---|
225 | { |
---|
226 | lnumber l = (lnumber)n; |
---|
227 | if (l==NULL) return -1; |
---|
228 | return napDeg(l->z); |
---|
229 | } |
---|
230 | |
---|
231 | //int naParDeg(number n) /* i := deg(n) */ |
---|
232 | //{ |
---|
233 | // lnumber l = (lnumber)n; |
---|
234 | // if (l==NULL) return -1; |
---|
235 | // return napMaxDeg(l->z)+napMaxDeg(l->n); |
---|
236 | //} |
---|
237 | |
---|
238 | int naSize(number n) /* size desc. */ |
---|
239 | { |
---|
240 | lnumber l = (lnumber)n; |
---|
241 | if (l==NULL) return -1; |
---|
242 | int len_z; |
---|
243 | int len_n; |
---|
244 | int o=napMaxDegLen(l->z,len_z)+napMaxDegLen(l->n,len_n); |
---|
245 | return (len_z+len_n)+o; |
---|
246 | } |
---|
247 | |
---|
248 | /*2 |
---|
249 | * convert a number to int (if possible) |
---|
250 | */ |
---|
251 | int naInt(number &n, const ring r) |
---|
252 | { |
---|
253 | lnumber l=(lnumber)n; |
---|
254 | if ((l!=NULL)&&(l->n==NULL)&&(p_IsConstant(l->z,r->algring))) |
---|
255 | { |
---|
256 | return nacInt(pGetCoeff(l->z),r->algring); |
---|
257 | } |
---|
258 | return 0; |
---|
259 | } |
---|
260 | |
---|
261 | /*2 |
---|
262 | * deletes p |
---|
263 | */ |
---|
264 | void naDelete(number *p, const ring r) |
---|
265 | { |
---|
266 | if ((*p)!=r->minpoly) |
---|
267 | { |
---|
268 | lnumber l = (lnumber) * p; |
---|
269 | if (l==NULL) return; |
---|
270 | p_Delete(&(l->z),r->algring); |
---|
271 | p_Delete(&(l->n),r->algring); |
---|
272 | omFreeBin((ADDRESS)l, rnumber_bin); |
---|
273 | } |
---|
274 | *p = NULL; |
---|
275 | } |
---|
276 | |
---|
277 | /*2 |
---|
278 | * copy p to erg |
---|
279 | */ |
---|
280 | number naCopy(number p) |
---|
281 | { |
---|
282 | if (p==NULL) return NULL; |
---|
283 | naTest(p); |
---|
284 | lnumber erg; |
---|
285 | lnumber src = (lnumber)p; |
---|
286 | erg = (lnumber)omAlloc0Bin(rnumber_bin); |
---|
287 | erg->z = p_Copy(src->z, nacRing); |
---|
288 | erg->n = p_Copy(src->n, nacRing); |
---|
289 | erg->s = src->s; |
---|
290 | return (number)erg; |
---|
291 | } |
---|
292 | number na_Copy(number p, const ring r) |
---|
293 | { |
---|
294 | if (p==NULL) return NULL; |
---|
295 | lnumber erg; |
---|
296 | lnumber src = (lnumber)p; |
---|
297 | erg = (lnumber)omAlloc0Bin(rnumber_bin); |
---|
298 | erg->z = p_Copy(src->z,r->algring); |
---|
299 | erg->n = p_Copy(src->n,r->algring); |
---|
300 | erg->s = src->s; |
---|
301 | return (number)erg; |
---|
302 | } |
---|
303 | |
---|
304 | /*2 |
---|
305 | * addition; lu:= la + lb |
---|
306 | */ |
---|
307 | number naAdd(number la, number lb) |
---|
308 | { |
---|
309 | if (la==NULL) return naCopy(lb); |
---|
310 | if (lb==NULL) return naCopy(la); |
---|
311 | |
---|
312 | napoly x, y; |
---|
313 | lnumber lu; |
---|
314 | lnumber a = (lnumber)la; |
---|
315 | lnumber b = (lnumber)lb; |
---|
316 | #ifdef LDEBUG |
---|
317 | omCheckAddrSize(a,sizeof(snumber)); |
---|
318 | omCheckAddrSize(b,sizeof(snumber)); |
---|
319 | #endif |
---|
320 | if (b->n!=NULL) x = pp_Mult_qq(a->z, b->n,nacRing); |
---|
321 | else x = napCopy(a->z); |
---|
322 | if (a->n!=NULL) y = pp_Mult_qq(b->z, a->n,nacRing); |
---|
323 | else y = napCopy(b->z); |
---|
324 | napoly res = napAdd(x, y); |
---|
325 | if (res==NULL) |
---|
326 | { |
---|
327 | return (number)NULL; |
---|
328 | } |
---|
329 | lu = (lnumber)omAllocBin(rnumber_bin); |
---|
330 | lu->z=res; |
---|
331 | if (a->n!=NULL) |
---|
332 | { |
---|
333 | if (b->n!=NULL) x = pp_Mult_qq(a->n, b->n,nacRing); |
---|
334 | else x = napCopy(a->n); |
---|
335 | } |
---|
336 | else |
---|
337 | { |
---|
338 | if (b->n!=NULL) x = napCopy(b->n); |
---|
339 | else x = NULL; |
---|
340 | } |
---|
341 | //if (x!=NULL) |
---|
342 | //{ |
---|
343 | // if (p_LmIsConstant(x,nacRing)) |
---|
344 | // { |
---|
345 | // number inv=nacInvers(pGetCoeff(x)); |
---|
346 | // napMultN(lu->z,inv); |
---|
347 | // n_Delete(&inv,nacRing); |
---|
348 | // napDelete(&x); |
---|
349 | // } |
---|
350 | //} |
---|
351 | lu->n = x; |
---|
352 | lu->s = FALSE; |
---|
353 | if (/*lu->n*/ x!=NULL) |
---|
354 | { |
---|
355 | number luu=(number)lu; |
---|
356 | //if (p_IsConstant(lu->n,nacRing)) naCoefNormalize(luu); |
---|
357 | //else |
---|
358 | naNormalize(luu); |
---|
359 | lu=(lnumber)luu; |
---|
360 | } |
---|
361 | //else lu->s=2; |
---|
362 | naTest((number)lu); |
---|
363 | return (number)lu; |
---|
364 | } |
---|
365 | |
---|
366 | /*2 |
---|
367 | * subtraction; r:= la - lb |
---|
368 | */ |
---|
369 | number naSub(number la, number lb) |
---|
370 | { |
---|
371 | lnumber lu; |
---|
372 | |
---|
373 | if (lb==NULL) return naCopy(la); |
---|
374 | if (la==NULL) |
---|
375 | { |
---|
376 | lu = (lnumber)naCopy(lb); |
---|
377 | lu->z = napNeg(lu->z); |
---|
378 | return (number)lu; |
---|
379 | } |
---|
380 | |
---|
381 | lnumber a = (lnumber)la; |
---|
382 | lnumber b = (lnumber)lb; |
---|
383 | |
---|
384 | #ifdef LDEBUG |
---|
385 | omCheckAddrSize(a,sizeof(snumber)); |
---|
386 | omCheckAddrSize(b,sizeof(snumber)); |
---|
387 | #endif |
---|
388 | |
---|
389 | napoly x, y; |
---|
390 | if (b->n!=NULL) x = pp_Mult_qq(a->z, b->n,nacRing); |
---|
391 | else x = napCopy(a->z); |
---|
392 | if (a->n!=NULL) y = p_Mult_q(napCopy(b->z), napCopyNeg(a->n),nacRing); |
---|
393 | else y = napCopyNeg(b->z); |
---|
394 | napoly res = napAdd(x, y); |
---|
395 | if (res==NULL) |
---|
396 | { |
---|
397 | return (number)NULL; |
---|
398 | } |
---|
399 | lu = (lnumber)omAllocBin(rnumber_bin); |
---|
400 | lu->z=res; |
---|
401 | if (a->n!=NULL) |
---|
402 | { |
---|
403 | if (b->n!=NULL) x = pp_Mult_qq(a->n, b->n,nacRing); |
---|
404 | else x = napCopy(a->n); |
---|
405 | } |
---|
406 | else |
---|
407 | { |
---|
408 | if (b->n!=NULL) x = napCopy(b->n); |
---|
409 | else x = NULL; |
---|
410 | } |
---|
411 | lu->n = x; |
---|
412 | lu->s = FALSE; |
---|
413 | if (/*lu->n*/ x!=NULL) |
---|
414 | { |
---|
415 | number luu=(number)lu; |
---|
416 | //if (p_IsConstant(lu->n,nacRing)) naCoefNormalize(luu); |
---|
417 | //else |
---|
418 | naNormalize(luu); |
---|
419 | lu=(lnumber)luu; |
---|
420 | } |
---|
421 | //else lu->s=2; |
---|
422 | naTest((number)lu); |
---|
423 | return (number)lu; |
---|
424 | } |
---|
425 | |
---|
426 | /*2 |
---|
427 | * multiplication; r:= la * lb |
---|
428 | */ |
---|
429 | number naMult(number la, number lb) |
---|
430 | { |
---|
431 | if ((la==NULL) || (lb==NULL)) |
---|
432 | return NULL; |
---|
433 | |
---|
434 | lnumber a = (lnumber)la; |
---|
435 | lnumber b = (lnumber)lb; |
---|
436 | lnumber lo; |
---|
437 | napoly x; |
---|
438 | |
---|
439 | #ifdef LDEBUG |
---|
440 | omCheckAddrSize(a,sizeof(snumber)); |
---|
441 | omCheckAddrSize(b,sizeof(snumber)); |
---|
442 | #endif |
---|
443 | naTest(la); |
---|
444 | naTest(lb); |
---|
445 | |
---|
446 | lo = (lnumber)omAllocBin(rnumber_bin); |
---|
447 | lo->z = pp_Mult_qq(a->z, b->z,nacRing); |
---|
448 | |
---|
449 | if (a->n==NULL) |
---|
450 | { |
---|
451 | if (b->n==NULL) |
---|
452 | x = NULL; |
---|
453 | else |
---|
454 | x = napCopy(b->n); |
---|
455 | } |
---|
456 | else |
---|
457 | { |
---|
458 | if (b->n==NULL) |
---|
459 | { |
---|
460 | x = napCopy(a->n); |
---|
461 | } |
---|
462 | else |
---|
463 | { |
---|
464 | x = pp_Mult_qq(b->n, a->n, nacRing); |
---|
465 | } |
---|
466 | } |
---|
467 | if (naMinimalPoly!=NULL) |
---|
468 | { |
---|
469 | if (p_GetExp(lo->z,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
470 | lo->z = napRemainder(lo->z, naMinimalPoly); |
---|
471 | if ((x!=NULL) && |
---|
472 | (p_GetExp(x,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing))) |
---|
473 | x = napRemainder(x, naMinimalPoly); |
---|
474 | } |
---|
475 | if (naI!=NULL) |
---|
476 | { |
---|
477 | lo->z = napRedp (lo->z); |
---|
478 | if (lo->z != NULL) |
---|
479 | lo->z = napTailred (lo->z); |
---|
480 | if (x!=NULL) |
---|
481 | { |
---|
482 | x = napRedp (x); |
---|
483 | if (x!=NULL) |
---|
484 | x = napTailred (x); |
---|
485 | } |
---|
486 | } |
---|
487 | if ((x!=NULL) && (p_LmIsConstant(x,nacRing)) && nacIsOne(pGetCoeff(x))) |
---|
488 | p_Delete(&x,nacRing); |
---|
489 | lo->n = x; |
---|
490 | lo->s = 0; |
---|
491 | if(lo->z==NULL) |
---|
492 | { |
---|
493 | omFreeBin((ADDRESS)lo, rnumber_bin); |
---|
494 | lo=NULL; |
---|
495 | } |
---|
496 | else if (lo->n!=NULL) |
---|
497 | { |
---|
498 | number luu=(number)lo; |
---|
499 | // if (p_IsConstant(lo->n,nacRing)) naCoefNormalize(luu); |
---|
500 | // else |
---|
501 | naNormalize(luu); |
---|
502 | lo=(lnumber)luu; |
---|
503 | } |
---|
504 | //if (naMinimalPoly==NULL) lo->s=2; |
---|
505 | naTest((number)lo); |
---|
506 | return (number)lo; |
---|
507 | } |
---|
508 | |
---|
509 | number naIntDiv(number la, number lb) |
---|
510 | { |
---|
511 | lnumber res; |
---|
512 | lnumber a = (lnumber)la; |
---|
513 | lnumber b = (lnumber)lb; |
---|
514 | if (a==NULL) |
---|
515 | { |
---|
516 | return NULL; |
---|
517 | } |
---|
518 | if (b==NULL) |
---|
519 | { |
---|
520 | WerrorS(nDivBy0); |
---|
521 | return NULL; |
---|
522 | } |
---|
523 | assume(a->z!=NULL && b->z!=NULL); |
---|
524 | assume(a->n==NULL && b->n==NULL); |
---|
525 | res = (lnumber)omAllocBin(rnumber_bin); |
---|
526 | res->z = napCopy(a->z); |
---|
527 | res->n = napCopy(b->z); |
---|
528 | res->s = 0; |
---|
529 | number nres=(number)res; |
---|
530 | naNormalize(nres); |
---|
531 | |
---|
532 | //napDelete(&res->n); |
---|
533 | naTest(nres); |
---|
534 | return nres; |
---|
535 | } |
---|
536 | |
---|
537 | /*2 |
---|
538 | * division; lo:= la / lb |
---|
539 | */ |
---|
540 | number naDiv(number la, number lb) |
---|
541 | { |
---|
542 | lnumber lo; |
---|
543 | lnumber a = (lnumber)la; |
---|
544 | lnumber b = (lnumber)lb; |
---|
545 | napoly x; |
---|
546 | |
---|
547 | if (a==NULL) |
---|
548 | return NULL; |
---|
549 | |
---|
550 | if (b==NULL) |
---|
551 | { |
---|
552 | WerrorS(nDivBy0); |
---|
553 | return NULL; |
---|
554 | } |
---|
555 | #ifdef LDEBUG |
---|
556 | omCheckAddrSize(a,sizeof(snumber)); |
---|
557 | omCheckAddrSize(b,sizeof(snumber)); |
---|
558 | #endif |
---|
559 | lo = (lnumber)omAllocBin(rnumber_bin); |
---|
560 | if (b->n!=NULL) |
---|
561 | lo->z = pp_Mult_qq(a->z, b->n,nacRing); |
---|
562 | else |
---|
563 | lo->z = napCopy(a->z); |
---|
564 | if (a->n!=NULL) |
---|
565 | x = pp_Mult_qq(b->z, a->n, nacRing); |
---|
566 | else |
---|
567 | x = napCopy(b->z); |
---|
568 | if (naMinimalPoly!=NULL) |
---|
569 | { |
---|
570 | if (p_GetExp(lo->z,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
571 | lo->z = napRemainder(lo->z, naMinimalPoly); |
---|
572 | if (p_GetExp(x,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
573 | x = napRemainder(x, naMinimalPoly); |
---|
574 | } |
---|
575 | if (naI!=NULL) |
---|
576 | { |
---|
577 | lo->z = napRedp (lo->z); |
---|
578 | if (lo->z != NULL) |
---|
579 | lo->z = napTailred (lo->z); |
---|
580 | if (x!=NULL) |
---|
581 | { |
---|
582 | x = napRedp (x); |
---|
583 | if (x!=NULL) |
---|
584 | x = napTailred (x); |
---|
585 | } |
---|
586 | } |
---|
587 | if ((p_LmIsConstant(x,nacRing)) && nacIsOne(pGetCoeff(x))) |
---|
588 | p_Delete(&x,nacRing); |
---|
589 | lo->n = x; |
---|
590 | lo->s = 0; |
---|
591 | if (lo->n!=NULL) |
---|
592 | { |
---|
593 | number luu=(number)lo; |
---|
594 | //if (p_IsConstant(lo->n,nacRing)) naCoefNormalize(luu); |
---|
595 | //else |
---|
596 | naNormalize(luu); |
---|
597 | lo=(lnumber)luu; |
---|
598 | } |
---|
599 | //else lo->s=2; |
---|
600 | naTest((number)lo); |
---|
601 | return (number)lo; |
---|
602 | } |
---|
603 | |
---|
604 | /*2 |
---|
605 | * za:= - za, inplace |
---|
606 | */ |
---|
607 | number naNeg(number za) |
---|
608 | { |
---|
609 | if (za!=NULL) |
---|
610 | { |
---|
611 | lnumber e = (lnumber)za; |
---|
612 | naTest(za); |
---|
613 | e->z = napNeg(e->z); |
---|
614 | } |
---|
615 | return za; |
---|
616 | } |
---|
617 | |
---|
618 | /*2 |
---|
619 | * 1/a |
---|
620 | */ |
---|
621 | number naInvers(number a) |
---|
622 | { |
---|
623 | lnumber lo; |
---|
624 | lnumber b = (lnumber)a; |
---|
625 | napoly x; |
---|
626 | |
---|
627 | if (b==NULL) |
---|
628 | { |
---|
629 | WerrorS(nDivBy0); |
---|
630 | return NULL; |
---|
631 | } |
---|
632 | #ifdef LDEBUG |
---|
633 | omCheckAddrSize(b,sizeof(snumber)); |
---|
634 | #endif |
---|
635 | lo = (lnumber)omAlloc0Bin(rnumber_bin); |
---|
636 | lo->s = b->s; |
---|
637 | if (b->n!=NULL) |
---|
638 | lo->z = napCopy(b->n); |
---|
639 | else |
---|
640 | lo->z = p_ISet(1,nacRing); |
---|
641 | x = b->z; |
---|
642 | if ((!p_LmIsConstant(x,nacRing)) || !nacIsOne(pGetCoeff(x))) |
---|
643 | x = napCopy(x); |
---|
644 | else |
---|
645 | { |
---|
646 | lo->n = NULL; |
---|
647 | naTest((number)lo); |
---|
648 | return (number)lo; |
---|
649 | } |
---|
650 | if (naMinimalPoly!=NULL) |
---|
651 | { |
---|
652 | x = napInvers(x, naMinimalPoly); |
---|
653 | x = p_Mult_q(x, lo->z,nacRing); |
---|
654 | if (p_GetExp(x,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
655 | x = napRemainder(x, naMinimalPoly); |
---|
656 | lo->z = x; |
---|
657 | lo->n = NULL; |
---|
658 | while (x!=NULL) |
---|
659 | { |
---|
660 | nacNormalize(pGetCoeff(x)); |
---|
661 | pIter(x); |
---|
662 | } |
---|
663 | } |
---|
664 | else |
---|
665 | lo->n = x; |
---|
666 | if (lo->n!=NULL) |
---|
667 | { |
---|
668 | number luu=(number)lo; |
---|
669 | //if (p_IsConstant(lo->n,nacRing)) naCoefNormalize(luu); |
---|
670 | //else |
---|
671 | naNormalize(luu); |
---|
672 | lo=(lnumber)luu; |
---|
673 | } |
---|
674 | naTest((number)lo); |
---|
675 | return (number)lo; |
---|
676 | } |
---|
677 | |
---|
678 | |
---|
679 | BOOLEAN naIsZero(number za) |
---|
680 | { |
---|
681 | lnumber zb = (lnumber)za; |
---|
682 | naTest(za); |
---|
683 | #ifdef LDEBUG |
---|
684 | if ((zb!=NULL) && (zb->z==NULL)) WerrorS("internal zero error(2)"); |
---|
685 | #endif |
---|
686 | return (zb==NULL); |
---|
687 | } |
---|
688 | |
---|
689 | |
---|
690 | BOOLEAN naGreaterZero(number za) |
---|
691 | { |
---|
692 | lnumber zb = (lnumber)za; |
---|
693 | #ifdef LDEBUG |
---|
694 | if ((zb!=NULL) && (zb->z==NULL)) WerrorS("internal zero error(3)"); |
---|
695 | #endif |
---|
696 | naTest(za); |
---|
697 | if (zb!=NULL) |
---|
698 | { |
---|
699 | return (nacGreaterZero(pGetCoeff(zb->z))||(!p_LmIsConstant(zb->z,nacRing))); |
---|
700 | } |
---|
701 | /* else */ return FALSE; |
---|
702 | } |
---|
703 | |
---|
704 | |
---|
705 | /*2 |
---|
706 | * a = b ? |
---|
707 | */ |
---|
708 | BOOLEAN naEqual (number a, number b) |
---|
709 | { |
---|
710 | if(a==b) return TRUE; |
---|
711 | if((a==NULL)&&(b!=NULL)) return FALSE; |
---|
712 | if((b==NULL)&&(a!=NULL)) return FALSE; |
---|
713 | |
---|
714 | lnumber aa=(lnumber)a; |
---|
715 | lnumber bb=(lnumber)b; |
---|
716 | |
---|
717 | int an_deg=0; |
---|
718 | if(aa->n!=NULL) |
---|
719 | an_deg=napDeg(aa->n); |
---|
720 | int bn_deg=0; |
---|
721 | if(bb->n!=NULL) |
---|
722 | bn_deg=napDeg(bb->n); |
---|
723 | if(an_deg+napDeg(bb->z)!=bn_deg+napDeg(aa->z)) |
---|
724 | return FALSE; |
---|
725 | #if 0 |
---|
726 | naNormalize(a); |
---|
727 | aa=(lnumber)a; |
---|
728 | naNormalize(b); |
---|
729 | bb=(lnumber)b; |
---|
730 | if((aa->n==NULL)&&(bb->n!=NULL)) return FALSE; |
---|
731 | if((bb->n==NULL)&&(aa->n!=NULL)) return FALSE; |
---|
732 | if(napComp(aa->z,bb->z)!=0) return FALSE; |
---|
733 | if((aa->n!=NULL) && (napComp(aa->n,bb->n))) return FALSE; |
---|
734 | #endif |
---|
735 | number h = naSub(a, b); |
---|
736 | BOOLEAN bo = naIsZero(h); |
---|
737 | naDelete(&h,currRing); |
---|
738 | return bo; |
---|
739 | } |
---|
740 | |
---|
741 | |
---|
742 | BOOLEAN naGreater (number a, number b) |
---|
743 | { |
---|
744 | if (naIsZero(a)) |
---|
745 | return FALSE; |
---|
746 | if (naIsZero(b)) |
---|
747 | return TRUE; /* a!= 0)*/ |
---|
748 | return napDeg(((lnumber)a)->z)>napDeg(((lnumber)b)->z); |
---|
749 | } |
---|
750 | |
---|
751 | /*2 |
---|
752 | * reads a number |
---|
753 | */ |
---|
754 | const char *naRead(const char *s, number *p) |
---|
755 | { |
---|
756 | napoly x; |
---|
757 | lnumber a; |
---|
758 | s = napRead(s, &x); |
---|
759 | if (x==NULL) |
---|
760 | { |
---|
761 | *p = NULL; |
---|
762 | return s; |
---|
763 | } |
---|
764 | *p = (number)omAlloc0Bin(rnumber_bin); |
---|
765 | a = (lnumber)*p; |
---|
766 | if ((naMinimalPoly!=NULL) |
---|
767 | && (p_GetExp(x,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing))) |
---|
768 | a->z = napRemainder(x, naMinimalPoly); |
---|
769 | else if (naI!=NULL) |
---|
770 | { |
---|
771 | a->z = napRedp(x); |
---|
772 | if (a->z != NULL) |
---|
773 | a->z = napTailred (a->z); |
---|
774 | } |
---|
775 | else |
---|
776 | a->z = x; |
---|
777 | if(a->z==NULL) |
---|
778 | { |
---|
779 | omFreeBin((ADDRESS)*p, rnumber_bin); |
---|
780 | *p=NULL; |
---|
781 | } |
---|
782 | else |
---|
783 | { |
---|
784 | a->n = NULL; |
---|
785 | a->s = 0; |
---|
786 | naTest(*p); |
---|
787 | } |
---|
788 | return s; |
---|
789 | } |
---|
790 | |
---|
791 | /*2 |
---|
792 | * tries to convert a number to a name |
---|
793 | */ |
---|
794 | char * naName(number n) |
---|
795 | { |
---|
796 | lnumber ph = (lnumber)n; |
---|
797 | if (ph==NULL) |
---|
798 | return NULL; |
---|
799 | int i; |
---|
800 | char *s=(char *)omAlloc(4* ntNumbOfPar); |
---|
801 | char *t=(char *)omAlloc(8); |
---|
802 | s[0]='\0'; |
---|
803 | for (i = 0; i <= ntNumbOfPar - 1; i++) |
---|
804 | { |
---|
805 | int e=p_GetExp(ph->z,i+1,nacRing); |
---|
806 | if (e > 0) |
---|
807 | { |
---|
808 | if (e >1) |
---|
809 | { |
---|
810 | sprintf(t,"%s%d",ntParNames[i],e); |
---|
811 | strcat(s,t); |
---|
812 | } |
---|
813 | else |
---|
814 | { |
---|
815 | strcat(s,ntParNames[i]); |
---|
816 | } |
---|
817 | } |
---|
818 | } |
---|
819 | omFreeSize((ADDRESS)t,8); |
---|
820 | if (s[0]=='\0') |
---|
821 | { |
---|
822 | omFree((ADDRESS)s); |
---|
823 | return NULL; |
---|
824 | } |
---|
825 | return s; |
---|
826 | } |
---|
827 | |
---|
828 | /*2 |
---|
829 | * writes a number |
---|
830 | */ |
---|
831 | void naWrite(number &phn, const ring r) |
---|
832 | { |
---|
833 | lnumber ph = (lnumber)phn; |
---|
834 | if (ph==NULL) |
---|
835 | StringAppendS("0"); |
---|
836 | else |
---|
837 | { |
---|
838 | phn->s = 0; |
---|
839 | BOOLEAN has_denom=(ph->n!=NULL); |
---|
840 | napWrite(ph->z,has_denom/*(ph->n!=NULL)*/,r); |
---|
841 | if (has_denom/*(ph->n!=NULL)*/) |
---|
842 | { |
---|
843 | StringAppendS("/"); |
---|
844 | napWrite(ph->n,TRUE,r); |
---|
845 | } |
---|
846 | } |
---|
847 | } |
---|
848 | |
---|
849 | /*2 |
---|
850 | * za == 1 ? |
---|
851 | */ |
---|
852 | BOOLEAN naIsOne(number za) |
---|
853 | { |
---|
854 | lnumber a = (lnumber)za; |
---|
855 | napoly x, y; |
---|
856 | number t; |
---|
857 | if (a==NULL) return FALSE; |
---|
858 | #ifdef LDEBUG |
---|
859 | omCheckAddrSize(a,sizeof(snumber)); |
---|
860 | if (a->z==NULL) |
---|
861 | { |
---|
862 | WerrorS("internal zero error(4)"); |
---|
863 | return FALSE; |
---|
864 | } |
---|
865 | #endif |
---|
866 | if (a->n==NULL) |
---|
867 | { |
---|
868 | if (p_LmIsConstant(a->z,nacRing)) |
---|
869 | { |
---|
870 | return nacIsOne(pGetCoeff(a->z)); |
---|
871 | } |
---|
872 | else return FALSE; |
---|
873 | } |
---|
874 | #if 0 |
---|
875 | x = a->z; |
---|
876 | y = a->n; |
---|
877 | do |
---|
878 | { |
---|
879 | if (napComp(x, y)) |
---|
880 | return FALSE; |
---|
881 | else |
---|
882 | { |
---|
883 | t = nacSub(pGetCoeff(x), pGetCoeff(y)); |
---|
884 | if (!nacIsZero(t)) |
---|
885 | { |
---|
886 | n_Delete(&t,nacRing); |
---|
887 | return FALSE; |
---|
888 | } |
---|
889 | else |
---|
890 | n_Delete(&t,nacRing); |
---|
891 | } |
---|
892 | pIter(x); |
---|
893 | pIter(y); |
---|
894 | } |
---|
895 | while ((x!=NULL) && (y!=NULL)); |
---|
896 | if ((x!=NULL) || (y!=NULL)) return FALSE; |
---|
897 | p_Delete(&a->z,nacRing); |
---|
898 | p_Delete(&a->n,nacRing); |
---|
899 | a->z = p_ISet(1,nacRing); |
---|
900 | a->n = NULL; |
---|
901 | return TRUE; |
---|
902 | #else |
---|
903 | return FALSE; |
---|
904 | #endif |
---|
905 | } |
---|
906 | |
---|
907 | /*2 |
---|
908 | * za == -1 ? |
---|
909 | */ |
---|
910 | BOOLEAN naIsMOne(number za) |
---|
911 | { |
---|
912 | lnumber a = (lnumber)za; |
---|
913 | napoly x, y; |
---|
914 | number t; |
---|
915 | if (a==NULL) return FALSE; |
---|
916 | #ifdef LDEBUG |
---|
917 | omCheckAddrSize(a,sizeof(snumber)); |
---|
918 | if (a->z==NULL) |
---|
919 | { |
---|
920 | WerrorS("internal zero error(5)"); |
---|
921 | return FALSE; |
---|
922 | } |
---|
923 | #endif |
---|
924 | if (a->n==NULL) |
---|
925 | { |
---|
926 | if (p_LmIsConstant(a->z,nacRing)) return nacIsMOne(pGetCoeff(a->z)); |
---|
927 | /*else return FALSE;*/ |
---|
928 | } |
---|
929 | return FALSE; |
---|
930 | } |
---|
931 | |
---|
932 | /*2 |
---|
933 | * returns the i-th power of p (i>=0) |
---|
934 | */ |
---|
935 | void naPower(number p, int i, number *rc) |
---|
936 | { |
---|
937 | number x; |
---|
938 | *rc = naInit(1,currRing); |
---|
939 | for (; i > 0; i--) |
---|
940 | { |
---|
941 | x = naMult(*rc, p); |
---|
942 | naDelete(rc,currRing); |
---|
943 | *rc = x; |
---|
944 | } |
---|
945 | } |
---|
946 | |
---|
947 | /*2 |
---|
948 | * result =gcd(a,b) |
---|
949 | */ |
---|
950 | number naGcd(number a, number b, const ring r) |
---|
951 | { |
---|
952 | if (a==NULL) return naCopy(b); |
---|
953 | if (b==NULL) return naCopy(a); |
---|
954 | |
---|
955 | lnumber x, y; |
---|
956 | lnumber result = (lnumber)omAlloc0Bin(rnumber_bin); |
---|
957 | |
---|
958 | x = (lnumber)a; |
---|
959 | y = (lnumber)b; |
---|
960 | if ((ntNumbOfPar == 1) && (naMinimalPoly!=NULL)) |
---|
961 | { |
---|
962 | if (pNext(x->z)!=NULL) |
---|
963 | result->z = p_Copy(x->z, r->algring); |
---|
964 | else |
---|
965 | result->z = napGcd0(x->z, y->z); |
---|
966 | } |
---|
967 | else |
---|
968 | #ifndef HAVE_FACTORY |
---|
969 | result->z = napGcd(x->z, y->z); // change from napGcd0 |
---|
970 | #else |
---|
971 | { |
---|
972 | int c=ABS(nGetChar()); |
---|
973 | if (c==1) c=0; |
---|
974 | setCharacteristic( c ); |
---|
975 | |
---|
976 | napoly rz=napGcd(x->z, y->z); |
---|
977 | CanonicalForm F, G, R; |
---|
978 | R=convSingPFactoryP(rz,r->algring); |
---|
979 | p_Normalize(x->z,nacRing); |
---|
980 | F=convSingPFactoryP(x->z,r->algring)/R; |
---|
981 | p_Normalize(y->z,nacRing); |
---|
982 | G=convSingPFactoryP(y->z,r->algring)/R; |
---|
983 | F = gcd( F, G ); |
---|
984 | if (F.isOne()) |
---|
985 | result->z= rz; |
---|
986 | else |
---|
987 | { |
---|
988 | p_Delete(&rz,r->algring); |
---|
989 | result->z=convFactoryPSingP( F*R,r->algring ); |
---|
990 | p_Normalize(result->z,nacRing); |
---|
991 | } |
---|
992 | } |
---|
993 | #endif |
---|
994 | naTest((number)result); |
---|
995 | return (number)result; |
---|
996 | } |
---|
997 | |
---|
998 | |
---|
999 | /*2 |
---|
1000 | * ntNumbOfPar = 1: |
---|
1001 | * clears denominator algebraic case; |
---|
1002 | * tries to simplify ratio transcendental case; |
---|
1003 | * |
---|
1004 | * cancels monomials |
---|
1005 | * occuring in denominator |
---|
1006 | * and enumerator ? ntNumbOfPar != 1; |
---|
1007 | * |
---|
1008 | * #defines for Factory: |
---|
1009 | * FACTORY_GCD_TEST: do not apply built in gcd for |
---|
1010 | * univariate polynomials, always use Factory |
---|
1011 | */ |
---|
1012 | //#define FACTORY_GCD_TEST |
---|
1013 | void naCoefNormalize(number pp) |
---|
1014 | { |
---|
1015 | if (pp==NULL) return; |
---|
1016 | lnumber p = (lnumber)pp; |
---|
1017 | number nz; // all denom. of the numerator |
---|
1018 | nz=p_GetAllDenom(p->z,nacRing); |
---|
1019 | BOOLEAN norm=FALSE; |
---|
1020 | if (!n_IsOne(nz,nacRing)) |
---|
1021 | { |
---|
1022 | norm=TRUE; |
---|
1023 | p->z=p_Mult_nn(p->z,nz,nacRing); |
---|
1024 | if (p->n==NULL) |
---|
1025 | { |
---|
1026 | p->n=p_NSet(nz,nacRing); |
---|
1027 | } |
---|
1028 | else |
---|
1029 | { |
---|
1030 | p->n=p_Mult_nn(p->n,nz,nacRing); |
---|
1031 | n_Delete(&nz, nacRing); |
---|
1032 | } |
---|
1033 | } |
---|
1034 | else |
---|
1035 | { |
---|
1036 | n_Delete(&nz, nacRing); |
---|
1037 | } |
---|
1038 | if (norm) |
---|
1039 | { |
---|
1040 | norm=FALSE; |
---|
1041 | p_Normalize(p->z,nacRing); |
---|
1042 | p_Normalize(p->n,nacRing); |
---|
1043 | } |
---|
1044 | number nn; |
---|
1045 | nn=p_GetAllDenom(p->n,nacRing); |
---|
1046 | if (!n_IsOne(nn,nacRing)) |
---|
1047 | { |
---|
1048 | norm=TRUE; |
---|
1049 | p->n=p_Mult_nn(p->n,nn,nacRing); |
---|
1050 | p->z=p_Mult_nn(p->z,nn,nacRing); |
---|
1051 | n_Delete(&nn, nacRing); |
---|
1052 | } |
---|
1053 | else |
---|
1054 | { |
---|
1055 | n_Delete(&nn, nacRing); |
---|
1056 | } |
---|
1057 | if (norm) |
---|
1058 | { |
---|
1059 | p_Normalize(p->z,nacRing); |
---|
1060 | p_Normalize(p->n,nacRing); |
---|
1061 | } |
---|
1062 | // remove common factors in n, z: |
---|
1063 | if (p->n!=NULL) |
---|
1064 | { |
---|
1065 | poly pp=p->z; |
---|
1066 | nz=n_Copy(pGetCoeff(pp),nacRing); |
---|
1067 | pIter(pp); |
---|
1068 | while(pp!=NULL) |
---|
1069 | { |
---|
1070 | if (n_IsOne(nz,nacRing)) break; |
---|
1071 | number d=n_Gcd(nz,pGetCoeff(pp),nacRing); |
---|
1072 | n_Delete(&nz,nacRing); nz=d; |
---|
1073 | pIter(pp); |
---|
1074 | } |
---|
1075 | if (!n_IsOne(nz,nacRing)) |
---|
1076 | { |
---|
1077 | pp=p->n; |
---|
1078 | nn=n_Copy(pGetCoeff(pp),nacRing); |
---|
1079 | pIter(pp); |
---|
1080 | while(pp!=NULL) |
---|
1081 | { |
---|
1082 | if (n_IsOne(nn,nacRing)) break; |
---|
1083 | number d=n_Gcd(nn,pGetCoeff(pp),nacRing); |
---|
1084 | n_Delete(&nn,nacRing); nn=d; |
---|
1085 | pIter(pp); |
---|
1086 | } |
---|
1087 | number ng=n_Gcd(nz,nn,nacRing); |
---|
1088 | n_Delete(&nn,nacRing); |
---|
1089 | if (!n_IsOne(ng,nacRing)) |
---|
1090 | { |
---|
1091 | number ni=n_Invers(ng,nacRing); |
---|
1092 | p->z=p_Mult_nn(p->z,ni,nacRing); |
---|
1093 | p->n=p_Mult_nn(p->n,ni,nacRing); |
---|
1094 | p_Normalize(p->z,nacRing); |
---|
1095 | p_Normalize(p->n,nacRing); |
---|
1096 | n_Delete(&ni,nacRing); |
---|
1097 | } |
---|
1098 | n_Delete(&ng,nacRing); |
---|
1099 | } |
---|
1100 | n_Delete(&nz,nacRing); |
---|
1101 | } |
---|
1102 | if (p->n!=NULL) |
---|
1103 | { |
---|
1104 | if(!nacGreaterZero(pGetCoeff(p->n))) |
---|
1105 | { |
---|
1106 | p->z=napNeg(p->z); |
---|
1107 | p->n=napNeg(p->n); |
---|
1108 | } |
---|
1109 | |
---|
1110 | if (/*(p->n!=NULL) && */ |
---|
1111 | (p_IsConstant(p->n,nacRing)) |
---|
1112 | && (n_IsOne(pGetCoeff(p->n),nacRing))) |
---|
1113 | { |
---|
1114 | p_Delete(&(p->n), nacRing); |
---|
1115 | p->n = NULL; |
---|
1116 | } |
---|
1117 | } |
---|
1118 | } |
---|
1119 | |
---|
1120 | void naNormalize(number &pp) |
---|
1121 | { |
---|
1122 | |
---|
1123 | //naTest(pp); // input may not be "normal" |
---|
1124 | lnumber p = (lnumber)pp; |
---|
1125 | |
---|
1126 | if (p==NULL) |
---|
1127 | return; |
---|
1128 | naCoefNormalize(pp); |
---|
1129 | p->s = 2; |
---|
1130 | napoly x = p->z; |
---|
1131 | napoly y = p->n; |
---|
1132 | |
---|
1133 | BOOLEAN norm=FALSE; |
---|
1134 | |
---|
1135 | if ((y!=NULL) && (naMinimalPoly!=NULL)) |
---|
1136 | { |
---|
1137 | y = napInvers(y, naMinimalPoly); |
---|
1138 | x = p_Mult_q(x, y,nacRing); |
---|
1139 | if (p_GetExp(x,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
1140 | x = napRemainder(x, naMinimalPoly); |
---|
1141 | p->z = x; |
---|
1142 | p->n = y = NULL; |
---|
1143 | norm=ntIsChar0; |
---|
1144 | } |
---|
1145 | |
---|
1146 | /* check for degree of x too high: */ |
---|
1147 | if ((x!=NULL) && (naMinimalPoly!=NULL) && (x!=naMinimalPoly) |
---|
1148 | && (p_GetExp(x,1,nacRing)>p_GetExp(naMinimalPoly,1,nacRing))) |
---|
1149 | // DO NOT REDUCE naMinimalPoly with itself |
---|
1150 | { |
---|
1151 | x = napRemainder(x, naMinimalPoly); |
---|
1152 | p->z = x; |
---|
1153 | norm=ntIsChar0; |
---|
1154 | } |
---|
1155 | /* normalize all coefficients in n and z (if in Q) */ |
---|
1156 | if (norm) |
---|
1157 | { |
---|
1158 | naCoefNormalize(pp); |
---|
1159 | x = p->z; |
---|
1160 | y = p->n; |
---|
1161 | } |
---|
1162 | if (y==NULL) return; |
---|
1163 | |
---|
1164 | if ((naMinimalPoly == NULL) && (x!=NULL) && (y!=NULL)) |
---|
1165 | { |
---|
1166 | int i; |
---|
1167 | for (i=ntNumbOfPar-1; i>=0; i--) |
---|
1168 | { |
---|
1169 | napoly xx=x; |
---|
1170 | napoly yy=y; |
---|
1171 | int m = napExpi(i, yy, xx); |
---|
1172 | if (m != 0) // in this case xx!=NULL!=yy |
---|
1173 | { |
---|
1174 | while (xx != NULL) |
---|
1175 | { |
---|
1176 | napAddExp(xx,i+1, -m); |
---|
1177 | pIter(xx); |
---|
1178 | } |
---|
1179 | while (yy != NULL) |
---|
1180 | { |
---|
1181 | napAddExp(yy,i+1, -m); |
---|
1182 | pIter(yy); |
---|
1183 | } |
---|
1184 | } |
---|
1185 | } |
---|
1186 | } |
---|
1187 | if (p_LmIsConstant(y,nacRing)) /* i.e. => simplify to (1/c)*z / monom */ |
---|
1188 | { |
---|
1189 | if (nacIsOne(pGetCoeff(y))) |
---|
1190 | { |
---|
1191 | p_LmDelete(&y,nacRing); |
---|
1192 | p->n = NULL; |
---|
1193 | naTest(pp); |
---|
1194 | return; |
---|
1195 | } |
---|
1196 | number h1 = nacInvers(pGetCoeff(y)); |
---|
1197 | nacNormalize(h1); |
---|
1198 | napMultN(x, h1); |
---|
1199 | n_Delete(&h1,nacRing); |
---|
1200 | p_LmDelete(&y,nacRing); |
---|
1201 | p->n = NULL; |
---|
1202 | naTest(pp); |
---|
1203 | return; |
---|
1204 | } |
---|
1205 | #ifndef FACTORY_GCD_TEST |
---|
1206 | if (ntNumbOfPar == 1) /* apply built-in gcd */ |
---|
1207 | { |
---|
1208 | napoly x1,y1; |
---|
1209 | if (p_GetExp(x,1,nacRing) >= p_GetExp(y,1,nacRing)) |
---|
1210 | { |
---|
1211 | x1 = napCopy(x); |
---|
1212 | y1 = napCopy(y); |
---|
1213 | } |
---|
1214 | else |
---|
1215 | { |
---|
1216 | x1 = napCopy(y); |
---|
1217 | y1 = napCopy(x); |
---|
1218 | } |
---|
1219 | napoly r; |
---|
1220 | loop |
---|
1221 | { |
---|
1222 | r = napRemainder(x1, y1); |
---|
1223 | if ((r==NULL) || (pNext(r)==NULL)) break; |
---|
1224 | x1 = y1; |
---|
1225 | y1 = r; |
---|
1226 | } |
---|
1227 | if (r!=NULL) |
---|
1228 | { |
---|
1229 | p_Delete(&r,nacRing); |
---|
1230 | p_Delete(&y1,nacRing); |
---|
1231 | } |
---|
1232 | else |
---|
1233 | { |
---|
1234 | napDivMod(x, y1, &(p->z), &r); |
---|
1235 | napDivMod(y, y1, &(p->n), &r); |
---|
1236 | p_Delete(&y1,nacRing); |
---|
1237 | } |
---|
1238 | x = p->z; |
---|
1239 | y = p->n; |
---|
1240 | /* collect all denoms from y and multiply x and y by it */ |
---|
1241 | if (ntIsChar0) |
---|
1242 | { |
---|
1243 | number n=napLcm(y); |
---|
1244 | napMultN(x,n); |
---|
1245 | napMultN(y,n); |
---|
1246 | n_Delete(&n,nacRing); |
---|
1247 | while(x!=NULL) |
---|
1248 | { |
---|
1249 | nacNormalize(pGetCoeff(x)); |
---|
1250 | pIter(x); |
---|
1251 | } |
---|
1252 | x = p->z; |
---|
1253 | while(y!=NULL) |
---|
1254 | { |
---|
1255 | nacNormalize(pGetCoeff(y)); |
---|
1256 | pIter(y); |
---|
1257 | } |
---|
1258 | y = p->n; |
---|
1259 | } |
---|
1260 | if (pNext(y)==NULL) |
---|
1261 | { |
---|
1262 | if (nacIsOne(pGetCoeff(y))) |
---|
1263 | { |
---|
1264 | if (p_GetExp(y,1,nacRing)==0) |
---|
1265 | { |
---|
1266 | p_LmDelete(&y,nacRing); |
---|
1267 | p->n = NULL; |
---|
1268 | } |
---|
1269 | naTest(pp); |
---|
1270 | return; |
---|
1271 | } |
---|
1272 | } |
---|
1273 | } |
---|
1274 | #endif /* FACTORY_GCD_TEST */ |
---|
1275 | #ifdef HAVE_FACTORY |
---|
1276 | #ifndef FACTORY_GCD_TEST |
---|
1277 | else |
---|
1278 | #endif |
---|
1279 | { |
---|
1280 | napoly xx,yy; |
---|
1281 | singclap_algdividecontent(x,y,xx,yy); |
---|
1282 | if (xx!=NULL) |
---|
1283 | { |
---|
1284 | p->z=xx; |
---|
1285 | p->n=yy; |
---|
1286 | p_Delete(&x,nacRing); |
---|
1287 | p_Delete(&y,nacRing); |
---|
1288 | } |
---|
1289 | } |
---|
1290 | #endif |
---|
1291 | /* remove common factors from z and n */ |
---|
1292 | x=p->z; |
---|
1293 | y=p->n; |
---|
1294 | if(!nacGreaterZero(pGetCoeff(y))) |
---|
1295 | { |
---|
1296 | x=napNeg(x); |
---|
1297 | y=napNeg(y); |
---|
1298 | } |
---|
1299 | number g=nacCopy(pGetCoeff(x)); |
---|
1300 | pIter(x); |
---|
1301 | while (x!=NULL) |
---|
1302 | { |
---|
1303 | number d=nacGcd(g,pGetCoeff(x), nacRing); |
---|
1304 | if(nacIsOne(d)) |
---|
1305 | { |
---|
1306 | n_Delete(&g,nacRing); |
---|
1307 | n_Delete(&d,nacRing); |
---|
1308 | naTest(pp); |
---|
1309 | return; |
---|
1310 | } |
---|
1311 | n_Delete(&g,nacRing); |
---|
1312 | g = d; |
---|
1313 | pIter(x); |
---|
1314 | } |
---|
1315 | while (y!=NULL) |
---|
1316 | { |
---|
1317 | number d=nacGcd(g,pGetCoeff(y), nacRing); |
---|
1318 | if(nacIsOne(d)) |
---|
1319 | { |
---|
1320 | n_Delete(&g,nacRing); |
---|
1321 | n_Delete(&d,nacRing); |
---|
1322 | naTest(pp); |
---|
1323 | return; |
---|
1324 | } |
---|
1325 | n_Delete(&g,nacRing); |
---|
1326 | g = d; |
---|
1327 | pIter(y); |
---|
1328 | } |
---|
1329 | x=p->z; |
---|
1330 | y=p->n; |
---|
1331 | while (x!=NULL) |
---|
1332 | { |
---|
1333 | number d = nacIntDiv(pGetCoeff(x),g); |
---|
1334 | napSetCoeff(x,d); |
---|
1335 | pIter(x); |
---|
1336 | } |
---|
1337 | while (y!=NULL) |
---|
1338 | { |
---|
1339 | number d = nacIntDiv(pGetCoeff(y),g); |
---|
1340 | napSetCoeff(y,d); |
---|
1341 | pIter(y); |
---|
1342 | } |
---|
1343 | n_Delete(&g,nacRing); |
---|
1344 | naTest(pp); |
---|
1345 | } |
---|
1346 | |
---|
1347 | /*2 |
---|
1348 | * returns in result->n 1 |
---|
1349 | * and in result->z the lcm(a->z,b->n) |
---|
1350 | */ |
---|
1351 | number naLcm(number la, number lb, const ring r) |
---|
1352 | { |
---|
1353 | lnumber result; |
---|
1354 | lnumber a = (lnumber)la; |
---|
1355 | lnumber b = (lnumber)lb; |
---|
1356 | result = (lnumber)omAlloc0Bin(rnumber_bin); |
---|
1357 | naTest(la); |
---|
1358 | naTest(lb); |
---|
1359 | napoly x = p_Copy(a->z, r->algring); |
---|
1360 | number t = napLcm(b->z); // get all denom of b->z |
---|
1361 | if (!nacIsOne(t)) |
---|
1362 | { |
---|
1363 | number bt, rr; |
---|
1364 | napoly xx=x; |
---|
1365 | while (xx!=NULL) |
---|
1366 | { |
---|
1367 | bt = nacGcd(t, pGetCoeff(xx), r->algring); |
---|
1368 | rr = nacMult(t, pGetCoeff(xx)); |
---|
1369 | n_Delete(&pGetCoeff(xx),r->algring); |
---|
1370 | pGetCoeff(xx) = nacDiv(rr, bt); |
---|
1371 | nacNormalize(pGetCoeff(xx)); |
---|
1372 | n_Delete(&bt,r->algring); |
---|
1373 | n_Delete(&rr,r->algring); |
---|
1374 | pIter(xx); |
---|
1375 | } |
---|
1376 | } |
---|
1377 | n_Delete(&t,r->algring); |
---|
1378 | result->z = x; |
---|
1379 | #ifdef HAVE_FACTORY |
---|
1380 | if (b->n!=NULL) |
---|
1381 | { |
---|
1382 | result->z=singclap_alglcm(result->z,b->n); |
---|
1383 | p_Delete(&x,r->algring); |
---|
1384 | } |
---|
1385 | #endif |
---|
1386 | naTest(la); |
---|
1387 | naTest(lb); |
---|
1388 | naTest((number)result); |
---|
1389 | return ((number)result); |
---|
1390 | } |
---|
1391 | |
---|
1392 | /*2 |
---|
1393 | * input: a set of constant polynomials |
---|
1394 | * sets the global variable naI |
---|
1395 | */ |
---|
1396 | void naSetIdeal(ideal I) |
---|
1397 | { |
---|
1398 | int i; |
---|
1399 | |
---|
1400 | if (idIs0(I)) |
---|
1401 | { |
---|
1402 | for (i=naI->anz-1; i>=0; i--) |
---|
1403 | p_Delete(&naI->liste[i],nacRing); |
---|
1404 | omFreeBin((ADDRESS)naI, snaIdeal_bin); |
---|
1405 | naI=NULL; |
---|
1406 | } |
---|
1407 | else |
---|
1408 | { |
---|
1409 | lnumber h; |
---|
1410 | number a; |
---|
1411 | napoly x; |
---|
1412 | |
---|
1413 | naI=(naIdeal)omAllocBin(snaIdeal_bin); |
---|
1414 | naI->anz=IDELEMS(I); |
---|
1415 | naI->liste=(napoly*)omAlloc(naI->anz*sizeof(napoly)); |
---|
1416 | for (i=IDELEMS(I)-1; i>=0; i--) |
---|
1417 | { |
---|
1418 | h=(lnumber)pGetCoeff(I->m[i]); |
---|
1419 | /* We only need the enumerator of h, as we expect it to be a polynomial */ |
---|
1420 | naI->liste[i]=napCopy(h->z); |
---|
1421 | /* If it isn't normalized (lc = 1) do this */ |
---|
1422 | if (!nacIsOne(pGetCoeff(naI->liste[i]))) |
---|
1423 | { |
---|
1424 | x=naI->liste[i]; |
---|
1425 | nacNormalize(pGetCoeff(x)); |
---|
1426 | a=nacCopy(pGetCoeff(x)); |
---|
1427 | number aa=nacInvers(a); |
---|
1428 | n_Delete(&a,nacRing); |
---|
1429 | napMultN(x,aa); |
---|
1430 | n_Delete(&aa,nacRing); |
---|
1431 | } |
---|
1432 | } |
---|
1433 | } |
---|
1434 | } |
---|
1435 | |
---|
1436 | /*2 |
---|
1437 | * map Z/p -> Q(a) |
---|
1438 | */ |
---|
1439 | number naMapP0(number c) |
---|
1440 | { |
---|
1441 | if (npIsZero(c)) return NULL; |
---|
1442 | lnumber l=(lnumber)omAllocBin(rnumber_bin); |
---|
1443 | l->s=2; |
---|
1444 | l->z=(napoly)p_Init(nacRing); |
---|
1445 | int i=(int)((long)c); |
---|
1446 | if (i>((long)ntMapRing->ch>>2)) i-=(long)ntMapRing->ch; |
---|
1447 | pGetCoeff(l->z)=nlInit(i, nacRing); |
---|
1448 | l->n=NULL; |
---|
1449 | return (number)l; |
---|
1450 | } |
---|
1451 | |
---|
1452 | /*2 |
---|
1453 | * map Q -> Q(a) |
---|
1454 | */ |
---|
1455 | number naMap00(number c) |
---|
1456 | { |
---|
1457 | if (nlIsZero(c)) return NULL; |
---|
1458 | lnumber l=(lnumber)omAllocBin(rnumber_bin); |
---|
1459 | l->s=0; |
---|
1460 | l->z=(napoly)p_Init(nacRing); |
---|
1461 | pGetCoeff(l->z)=nlCopy(c); |
---|
1462 | l->n=NULL; |
---|
1463 | return (number)l; |
---|
1464 | } |
---|
1465 | |
---|
1466 | /*2 |
---|
1467 | * map Z/p -> Z/p(a) |
---|
1468 | */ |
---|
1469 | number naMapPP(number c) |
---|
1470 | { |
---|
1471 | if (npIsZero(c)) return NULL; |
---|
1472 | lnumber l=(lnumber)omAllocBin(rnumber_bin); |
---|
1473 | l->s=2; |
---|
1474 | l->z=(napoly)p_Init(nacRing); |
---|
1475 | pGetCoeff(l->z)=c; /* omit npCopy, because npCopy is a no-op */ |
---|
1476 | l->n=NULL; |
---|
1477 | return (number)l; |
---|
1478 | } |
---|
1479 | |
---|
1480 | /*2 |
---|
1481 | * map Z/p' -> Z/p(a) |
---|
1482 | */ |
---|
1483 | number naMapPP1(number c) |
---|
1484 | { |
---|
1485 | if (npIsZero(c)) return NULL; |
---|
1486 | int i=(int)((long)c); |
---|
1487 | if (i>(long)ntMapRing->ch) i-=(long)ntMapRing->ch; |
---|
1488 | number n=npInit(i,ntMapRing); |
---|
1489 | if (npIsZero(n)) return NULL; |
---|
1490 | lnumber l=(lnumber)omAllocBin(rnumber_bin); |
---|
1491 | l->s=2; |
---|
1492 | l->z=(napoly)p_Init(nacRing); |
---|
1493 | pGetCoeff(l->z)=n; |
---|
1494 | l->n=NULL; |
---|
1495 | return (number)l; |
---|
1496 | } |
---|
1497 | |
---|
1498 | /*2 |
---|
1499 | * map Q -> Z/p(a) |
---|
1500 | */ |
---|
1501 | number naMap0P(number c) |
---|
1502 | { |
---|
1503 | if (nlIsZero(c)) return NULL; |
---|
1504 | number n=npInit(nlModP(c,npPrimeM),nacRing); |
---|
1505 | if (npIsZero(n)) return NULL; |
---|
1506 | npTest(n); |
---|
1507 | lnumber l=(lnumber)omAllocBin(rnumber_bin); |
---|
1508 | l->s=2; |
---|
1509 | l->z=(napoly)p_Init(nacRing); |
---|
1510 | pGetCoeff(l->z)=n; |
---|
1511 | l->n=NULL; |
---|
1512 | return (number)l; |
---|
1513 | } |
---|
1514 | |
---|
1515 | /*2 |
---|
1516 | * map _(a) -> _(b) |
---|
1517 | */ |
---|
1518 | number naMapQaQb(number c) |
---|
1519 | { |
---|
1520 | if (c==NULL) return NULL; |
---|
1521 | lnumber erg= (lnumber)omAlloc0Bin(rnumber_bin); |
---|
1522 | lnumber src =(lnumber)c; |
---|
1523 | erg->s=src->s; |
---|
1524 | erg->z=napMap(src->z); |
---|
1525 | erg->n=napMap(src->n); |
---|
1526 | if (naMinimalPoly!=NULL) |
---|
1527 | { |
---|
1528 | if (p_GetExp(erg->z,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
1529 | { |
---|
1530 | erg->z = napRemainder(erg->z, naMinimalPoly); |
---|
1531 | if (erg->z==NULL) |
---|
1532 | { |
---|
1533 | number t_erg=(number)erg; |
---|
1534 | naDelete(&t_erg,currRing); |
---|
1535 | return (number)NULL; |
---|
1536 | } |
---|
1537 | } |
---|
1538 | if (erg->n!=NULL) |
---|
1539 | { |
---|
1540 | if (p_GetExp(erg->n,1,nacRing) >= p_GetExp(naMinimalPoly,1,nacRing)) |
---|
1541 | erg->n = napRemainder(erg->n, naMinimalPoly); |
---|
1542 | if ((p_IsConstant(erg->n,nacRing)) && nacIsOne(pGetCoeff(erg->n))) |
---|
1543 | p_Delete(&(erg->n),nacRing); |
---|
1544 | } |
---|
1545 | } |
---|
1546 | return (number)erg; |
---|
1547 | } |
---|
1548 | |
---|
1549 | nMapFunc naSetMap(const ring src, const ring dst) |
---|
1550 | { |
---|
1551 | ntMapRing=src; |
---|
1552 | if (rField_is_Q_a(dst)) /* -> Q(a) */ |
---|
1553 | { |
---|
1554 | if (rField_is_Q(src)) |
---|
1555 | { |
---|
1556 | return naMap00; /*Q -> Q(a)*/ |
---|
1557 | } |
---|
1558 | if (rField_is_Zp(src)) |
---|
1559 | { |
---|
1560 | return naMapP0; /* Z/p -> Q(a)*/ |
---|
1561 | } |
---|
1562 | if (rField_is_Q_a(src)) |
---|
1563 | { |
---|
1564 | int i; |
---|
1565 | ntParsToCopy=0; |
---|
1566 | for(i=0;i<rPar(src);i++) |
---|
1567 | { |
---|
1568 | if ((i>=rPar(dst)) |
---|
1569 | ||(strcmp(src->parameter[i],dst->parameter[i])!=0)) |
---|
1570 | return NULL; |
---|
1571 | ntParsToCopy++; |
---|
1572 | } |
---|
1573 | nacMap=nacCopy; |
---|
1574 | if ((ntParsToCopy==rPar(dst))&&(ntParsToCopy==rPar(src))) |
---|
1575 | return naCopy; /* Q(a) -> Q(a) */ |
---|
1576 | return naMapQaQb; /* Q(a..) -> Q(a..) */ |
---|
1577 | } |
---|
1578 | } |
---|
1579 | /*-----------------------------------------------------*/ |
---|
1580 | if (rField_is_Zp_a(dst)) /* -> Z/p(a) */ |
---|
1581 | { |
---|
1582 | if (rField_is_Q(src)) |
---|
1583 | { |
---|
1584 | return naMap0P; /*Q -> Z/p(a)*/ |
---|
1585 | } |
---|
1586 | if (rField_is_Zp(src)) |
---|
1587 | { |
---|
1588 | if (src->ch==dst->ch) |
---|
1589 | { |
---|
1590 | return naMapPP; /* Z/p -> Z/p(a)*/ |
---|
1591 | } |
---|
1592 | else |
---|
1593 | { |
---|
1594 | return naMapPP1; /* Z/p' -> Z/p(a)*/ |
---|
1595 | } |
---|
1596 | } |
---|
1597 | if (rField_is_Zp_a(src)) |
---|
1598 | { |
---|
1599 | if (rChar(src)==rChar(dst)) |
---|
1600 | { |
---|
1601 | nacMap=nacCopy; |
---|
1602 | } |
---|
1603 | else |
---|
1604 | { |
---|
1605 | nacMap = npMapP; |
---|
1606 | } |
---|
1607 | int i; |
---|
1608 | ntParsToCopy=0; |
---|
1609 | for(i=0;i<rPar(src);i++) |
---|
1610 | { |
---|
1611 | if ((i>=rPar(dst)) |
---|
1612 | ||(strcmp(src->parameter[i],dst->parameter[i])!=0)) |
---|
1613 | return NULL; |
---|
1614 | ntParsToCopy++; |
---|
1615 | } |
---|
1616 | if ((ntParsToCopy==rPar(dst))&&(ntParsToCopy==rPar(src)) |
---|
1617 | && (nacMap==nacCopy)) |
---|
1618 | return naCopy; /* Z/p(a) -> Z/p(a) */ |
---|
1619 | return naMapQaQb; /* Z/p(a),Z/p'(a) -> Z/p(b)*/ |
---|
1620 | } |
---|
1621 | } |
---|
1622 | return NULL; /* default */ |
---|
1623 | } |
---|
1624 | |
---|
1625 | #ifdef LDEBUG |
---|
1626 | BOOLEAN naDBTest(number a, const char *f,const int l) |
---|
1627 | { |
---|
1628 | lnumber x=(lnumber)a; |
---|
1629 | if (x == NULL) |
---|
1630 | return TRUE; |
---|
1631 | #ifdef LDEBUG |
---|
1632 | omCheckAddrSize(a, sizeof(snumber)); |
---|
1633 | #endif |
---|
1634 | napoly p = x->z; |
---|
1635 | if (p==NULL) |
---|
1636 | { |
---|
1637 | Print("0/* in %s:%d\n",f,l); |
---|
1638 | return FALSE; |
---|
1639 | } |
---|
1640 | while(p!=NULL) |
---|
1641 | { |
---|
1642 | if (( ntIsChar0 && nlIsZero(pGetCoeff(p))) |
---|
1643 | || ((!ntIsChar0) && npIsZero(pGetCoeff(p)))) |
---|
1644 | { |
---|
1645 | Print("coeff 0 in %s:%d\n",f,l); |
---|
1646 | return FALSE; |
---|
1647 | } |
---|
1648 | if((naMinimalPoly!=NULL) |
---|
1649 | &&(p_GetExp(p,1,nacRing)>p_GetExp(naMinimalPoly,1,nacRing)) |
---|
1650 | &&(p!=naMinimalPoly)) |
---|
1651 | { |
---|
1652 | Print("deg>minpoly in %s:%d\n",f,l); |
---|
1653 | return FALSE; |
---|
1654 | } |
---|
1655 | //if (ntIsChar0 && (((int)p->ko &3) == 0) && (p->ko->s==0) && (x->s==2)) |
---|
1656 | //{ |
---|
1657 | // Print("normalized with non-normal coeffs in %s:%d\n",f,l); |
---|
1658 | // return FALSE; |
---|
1659 | //} |
---|
1660 | if (ntIsChar0 && !(nlDBTest(pGetCoeff(p),f,l))) |
---|
1661 | return FALSE; |
---|
1662 | pIter(p); |
---|
1663 | } |
---|
1664 | p = x->n; |
---|
1665 | while(p!=NULL) |
---|
1666 | { |
---|
1667 | if (ntIsChar0 && !(nlDBTest(pGetCoeff(p),f,l))) |
---|
1668 | return FALSE; |
---|
1669 | pIter(p); |
---|
1670 | } |
---|
1671 | return TRUE; |
---|
1672 | } |
---|
1673 | #endif |
---|