Annotation of OpenXM_contrib2/asir2000/engine/Mgfs.c, Revision 1.5
1.5 ! noro 1: /* $OpenXM: OpenXM_contrib2/asir2000/engine/Mgfs.c,v 1.4 2001/06/25 04:11:42 noro Exp $ */
1.1 noro 2:
3: #include "ca.h"
4:
1.5 ! noro 5: extern int up_kara_mag, current_gfs_q1;
! 6: extern int *current_gfs_plus1;
! 7:
1.1 noro 8: void mulssfum(UM,int,UM);
1.5 ! noro 9: void kmulsfummain(UM,UM,UM);
! 10:
! 11: inline int _ADDSF(a,b)
! 12: int a,b;
! 13: {
! 14: if ( !a )
! 15: return b;
! 16: else if ( !b )
! 17: return a;
! 18:
! 19: a = IFTOF(a); b = IFTOF(b);
! 20: if ( a > b ) {
! 21: /* tab[a]+tab[b] = tab[b](tab[a-b]+1) */
! 22: a = current_gfs_plus1[a-b];
! 23: if ( a < 0 )
! 24: return 0;
! 25: else {
! 26: a += b;
! 27: if ( a >= current_gfs_q1 )
! 28: a -= current_gfs_q1;
! 29: return FTOIF(a);
! 30: }
! 31: } else {
! 32: /* tab[a]+tab[b] = tab[a](tab[b-a]+1) */
! 33: b = current_gfs_plus1[b-a];
! 34: if ( b < 0 )
! 35: return 0;
! 36: else {
! 37: b += a;
! 38: if ( b >= current_gfs_q1 )
! 39: b -= current_gfs_q1;
! 40: return FTOIF(b);
! 41: }
! 42: }
! 43: }
! 44:
! 45: inline int _MULSF(a,b)
! 46: int a,b;
! 47: {
! 48: if ( !a || !b )
! 49: return 0;
! 50: else {
! 51: a = IFTOF(a) + IFTOF(b);
! 52: if ( a >= current_gfs_q1 )
! 53: a -= current_gfs_q1;
! 54: return FTOIF(a);
! 55: }
! 56: }
1.1 noro 57:
58: void addsfum(p1,p2,pr)
59: UM p1,p2,pr;
60: {
61: int *c1,*c2,*cr,i,dmax,dmin;
62:
63: if ( DEG(p1) == -1 ) {
64: cpyum(p2,pr);
65: return;
66: }
67: if ( DEG(p2) == -1 ) {
68: cpyum(p1,pr);
69: return;
70: }
71: if ( DEG(p1) >= DEG(p2) ) {
72: c1 = COEF(p1); c2 = COEF(p2); dmax = DEG(p1); dmin = DEG(p2);
73: } else {
74: c1 = COEF(p2); c2 = COEF(p1); dmax = DEG(p2); dmin = DEG(p1);
75: }
76: for ( i = 0, cr = COEF(pr); i <= dmin; i++ )
1.5 ! noro 77: cr[i] = _ADDSF(c1[i],c2[i]);
1.1 noro 78: for ( ; i <= dmax; i++ )
79: cr[i] = c1[i];
80: if ( dmax == dmin )
81: degum(pr,dmax);
82: else
83: DEG(pr) = dmax;
84: }
85:
86: void subsfum(p1,p2,pr)
87: UM p1,p2,pr;
88: {
89: int *c1,*c2,*cr,i;
90: int dmax,dmin;
91:
92: if ( DEG(p1) == -1 ) {
93: for ( i = DEG(pr) = DEG(p2), c2 = COEF(p2), cr = COEF(pr);
94: i >= 0; i-- )
95: cr[i] = _chsgnsf(c2[i]);
96: return;
97: }
98: if ( DEG(p2) == -1 ) {
99: cpyum(p1,pr);
100: return;
101: }
102: c1 = COEF(p1); c2 = COEF(p2); cr = COEF(pr);
103: if ( DEG(p1) >= DEG(p2) ) {
104: dmax = DEG(p1); dmin = DEG(p2);
105: for ( i = 0; i <= dmin; i++ )
106: cr[i] = _subsf(c1[i],c2[i]);
107: for ( ; i <= dmax; i++ )
108: cr[i] = c1[i];
109: } else {
110: dmax = DEG(p2); dmin = DEG(p1);
111: for ( i = 0; i <= dmin; i++ )
112: cr[i] = _subsf(c1[i],c2[i]);
113: for ( ; i <= dmax; i++ )
114: cr[i] = _chsgnsf(c2[i]);
115: }
116: if ( dmax == dmin )
117: degum(pr,dmax);
118: else
119: DEG(pr) = dmax;
120: }
121:
122: void gcdsfum(p1,p2,pr)
123: UM p1,p2,pr;
124: {
125: int inv;
126: UM t1,t2,q,tum;
127: int drem;
128:
129: if ( DEG(p1) < 0 )
130: cpyum(p2,pr);
131: else if ( DEG(p2) < 0 )
132: cpyum(p1,pr);
133: else {
134: if ( DEG(p1) >= DEG(p2) ) {
135: t1 = p1; t2 = p2;
136: } else {
137: t1 = p2; t2 = p1;
138: }
139: q = W_UMALLOC(DEG(t1));
140: while ( ( drem = divsfum(t1,t2,q) ) >= 0 ) {
141: tum = t1; t1 = t2; t2 = tum; DEG(t2) = drem;
142: }
143: inv = _invsf(COEF(t2)[DEG(t2)]);
144: mulssfum(t2,inv,pr);
145: }
146: }
147: void mulsfum(p1,p2,pr)
148: UM p1,p2,pr;
149: {
150: int *pc1,*pcr;
151: int *c1,*c2,*cr;
152: int mul;
153: int i,j,d1,d2;
154:
155: if ( ( (d1 = DEG(p1)) < 0) || ( (d2 = DEG(p2)) < 0 ) ) {
156: DEG(pr) = -1;
157: return;
158: }
159: c1 = COEF(p1); c2 = COEF(p2); cr = COEF(pr);
160: bzero((char *)cr,(int)((d1+d2+1)*sizeof(int)));
161: for ( i = 0; i <= d2; i++, cr++ )
162: if ( mul = *c2++ )
163: for ( j = 0, pc1 = c1, pcr = cr; j <= d1; j++, pc1++, pcr++ )
1.5 ! noro 164: if ( *pc1 )
! 165: *pcr = _ADDSF(_MULSF(*pc1,mul),*pcr);
1.1 noro 166: DEG(pr) = d1 + d2;
167: }
168:
169: void mulssfum(p,n,pr)
170: int n;
171: UM p,pr;
172: {
173: int *sp,*dp;
174: int i;
175:
176: for ( i = DEG(pr) = DEG(p), sp = COEF(p)+i, dp = COEF(pr)+i;
177: i >= 0; i--, dp--, sp-- )
1.5 ! noro 178: *dp = _MULSF(*sp,n);
1.1 noro 179: }
180:
1.5 ! noro 181: void kmulsfum(n1,n2,nr)
! 182: UM n1,n2,nr;
! 183: {
! 184: UM n,t,s,m,carry;
! 185: int d,d1,d2,len,i,l;
! 186: unsigned int *r,*r0;
! 187:
! 188: if ( !n1 || !n2 ) {
! 189: nr->d = -1; return;
! 190: }
! 191: d1 = DEG(n1)+1; d2 = DEG(n2)+1;
! 192: if ( (d1 < up_kara_mag) || (d2 < up_kara_mag) ) {
! 193: mulsfum(n1,n2,nr); return;
! 194: }
! 195: if ( d1 < d2 ) {
! 196: n = n1; n1 = n2; n2 = n;
! 197: d = d1; d1 = d2; d2 = d;
! 198: }
! 199: if ( d2 > (d1+1)/2 ) {
! 200: kmulsfummain(n1,n2,nr); return;
! 201: }
! 202: d = (d1/d2)+((d1%d2)!=0);
! 203: len = (d+1)*d2;
! 204: r0 = (unsigned int *)ALLOCA(len*sizeof(int));
! 205: bzero((char *)r0,len*sizeof(int));
! 206: m = W_UMALLOC(d2+1);
! 207: carry = W_UMALLOC(d2+1);
! 208: t = W_UMALLOC(d1+d2+1);
! 209: s = W_UMALLOC(d1+d2+1);
! 210: for ( DEG(carry) = -1, i = 0, r = r0; i < d; i++, r += d2 ) {
! 211: extractum(n1,i*d2,d2,m);
! 212: if ( m ) {
! 213: kmulsfum(m,n2,t);
! 214: addsfum(t,carry,s);
! 215: c_copyum(s,d2,r);
! 216: extractum(s,d2,d2,carry);
! 217: } else {
! 218: c_copyum(carry,d2,r);
! 219: carry = 0;
! 220: }
! 221: }
! 222: c_copyum(carry,d2,r);
! 223: for ( l = len - 1; !r0[l]; l-- );
! 224: l++;
! 225: DEG(nr) = l-1;
! 226: bcopy((char *)r0,(char *)COEF(nr),l*sizeof(int));
! 227: }
! 228:
! 229: void kmulsfummain(n1,n2,nr)
! 230: UM n1,n2,nr;
! 231: {
! 232: int d1,d2,h,len;
! 233: UM n1lo,n1hi,n2lo,n2hi,hi,lo,mid1,mid2,mid,s1,s2,t1,t2;
! 234:
! 235: d1 = DEG(n1)+1; d2 = DEG(n2)+1; h = (d1+1)/2;
! 236: n1lo = W_UMALLOC(d1+1); n1hi = W_UMALLOC(d1+1);
! 237: n2lo = W_UMALLOC(d2+1); n2hi = W_UMALLOC(d2+1);
! 238: lo = W_UMALLOC(d1+d2+1); hi = W_UMALLOC(d1+d2+1);
! 239: mid1 = W_UMALLOC(d1+d2+1); mid2 = W_UMALLOC(d1+d2+1);
! 240: mid = W_UMALLOC(d1+d2+1);
! 241: s1 = W_UMALLOC(d1+d2+1); s2 = W_UMALLOC(d1+d2+1);
! 242: extractum(n1,0,h,n1lo); extractum(n1,h,d1-h,n1hi);
! 243: extractum(n2,0,h,n2lo); extractum(n2,h,d2-h,n2hi);
! 244: kmulsfum(n1hi,n2hi,hi); kmulsfum(n1lo,n2lo,lo);
! 245: len = DEG(hi)+1+2*h; t1 = W_UMALLOC(len-1); DEG(t1) = len-1;
! 246: bzero((char *)COEF(t1),len*sizeof(int));
! 247: if ( lo )
! 248: bcopy((char *)COEF(lo),(char *)COEF(t1),(DEG(lo)+1)*sizeof(int));
! 249: if ( hi )
! 250: bcopy((char *)COEF(hi),(char *)(COEF(t1)+2*h),(DEG(hi)+1)*sizeof(int));
! 251:
! 252: addsfum(hi,lo,mid1);
! 253: subsfum(n1hi,n1lo,s1); subsfum(n2lo,n2hi,s2);
! 254: kmulsfum(s1,s2,mid2); addsfum(mid1,mid2,mid);
! 255: if ( mid ) {
! 256: len = DEG(mid)+1+h; t2 = W_UMALLOC(len-1); DEG(t2) = len-1;
! 257: bzero((char *)COEF(t2),len*sizeof(int));
! 258: bcopy((char *)COEF(mid),(char *)(COEF(t2)+h),(DEG(mid)+1)*sizeof(int));
! 259: addsfum(t1,t2,nr);
! 260: } else
! 261: copyum(t1,nr);
! 262: }
! 263:
1.1 noro 264: int divsfum(p1,p2,pq)
265: UM p1,p2,pq;
266: {
267: int *pc1,*pct;
268: int *c1,*c2,*ct;
269: int inv,hd,tmp;
270: int i,j, d1,d2,dd;
271:
272: if ( (d1 = DEG(p1)) < (d2 = DEG(p2)) ) {
273: DEG(pq) = -1;
274: return d1;
275: }
276: c1 = COEF(p1); c2 = COEF(p2); dd = d1-d2;
277: if ( ( hd = c2[d2] ) != _onesf() ) {
278: inv = _invsf(hd);
279: for ( pc1 = c2 + d2; pc1 >= c2; pc1-- )
1.5 ! noro 280: *pc1 = _MULSF(*pc1,inv);
1.1 noro 281: } else
282: inv = _onesf();
283: for ( i = dd, ct = c1+d1; i >= 0; i-- )
284: if ( tmp = *ct-- ) {
285: tmp = _chsgnsf(tmp);
286: for ( j = d2-1, pct = ct, pc1 = c2+j; j >= 0; j--, pct--, pc1-- )
1.5 ! noro 287: *pct = _ADDSF(_MULSF(*pc1,tmp),*pct);
1.1 noro 288: }
289: if ( inv != _onesf() ) {
290: for ( pc1 = c1+d2, pct = c1+d1; pc1 <= pct; pc1++ )
1.5 ! noro 291: *pc1 = _MULSF(*pc1,inv);
1.1 noro 292: for ( pc1 = c2, pct = c2+d2; pc1 <= pct; pc1++ )
1.5 ! noro 293: *pc1 = _MULSF(*pc1,hd);
1.1 noro 294: }
295: for ( i = d2-1, pc1 = c1+i; i >= 0 && !(*pc1); pc1--, i-- );
296: for ( DEG(pq) = j = dd, pc1 = c1+d1, pct = COEF(pq)+j; j >= 0; j-- )
297: *pct-- = *pc1--;
298: return i;
299: }
300:
301: void diffsfum(f,fd)
302: UM f,fd;
303: {
304: int *dp,*sp;
305: int i;
306:
307: for ( i = DEG(f), dp = COEF(fd)+i-1, sp = COEF(f)+i;
308: i >= 1; i--, dp--, sp-- ) {
1.5 ! noro 309: *dp = _MULSF(*sp,_itosf(i));
1.1 noro 310: }
311: degum(fd,DEG(f) - 1);
312: }
313:
314: void monicsfum(f)
315: UM f;
316: {
317: int *sp;
318: int i,inv;
319:
320: i = DEG(f); sp = COEF(f)+i;
321: inv = _invsf(*sp);
322: for ( ; i >= 0; i--, sp-- )
1.5 ! noro 323: *sp = _MULSF(*sp,inv);
1.2 noro 324: }
325:
1.3 noro 326: void addsfarray(int,int *,int *);
327: void mulsfarray_trunc(int,int *,int *,int *);
1.2 noro 328:
329: void mulsflum(n,f1,f2,fr)
330: int n;
331: LUM f1,f2,fr;
332: {
333: int max;
334: int i,j,**p1,**p2,*px;
335: int *w,*w1,*w2;
336:
337: p1 = (int **)COEF(f1); p2 = (int **)COEF(f2);
338: w = W_ALLOC(2*(n+1)); w1 = W_ALLOC(DEG(f1)); w2 = W_ALLOC(DEG(f2));
339: for ( i = DEG(f1); i >= 0; i-- ) {
340: for ( j = n - 1, px = p1[i]; ( j >= 0 ) && ( px[j] == 0 ); j-- );
341: w1[i] = ( j == -1 ? 0 : 1 );
342: }
343: for ( i = DEG(f2); i >= 0; i-- ) {
344: for ( j = n - 1, px = p2[i]; ( j >= 0 ) && ( px[j] == 0 ); j-- );
345: w2[i] = ( j == -1 ? 0 : 1 );
346: }
347: for ( j = DEG(fr) = DEG(f1) + DEG(f2); j >= 0; j-- ) {
348: for ( i = n - 1, px = COEF(fr)[j]; i >= 0; i-- )
349: px[i] = 0;
350: for ( max = MIN(DEG(f1),j), i = MAX(0,j-DEG(f2)); i <= max; i++ )
351: if ( w1[i] != 0 && w2[j - i] != 0 ) {
1.3 noro 352: mulsfarray_trunc(n,p1[i],p2[j - i],w); addsfarray(n,w,px);
1.2 noro 353: }
354: }
355: }
356:
1.4 noro 357: /* f1 = f1->c[0]+f1->c[1]*y+..., f2 = f2->c[0]+f2->c[1]*y+... mod y^n */
358:
359: void mulsfbm(bound,f1,f2,fr)
360: int bound;
361: BM f1,f2,fr;
362: {
363: UM mul,t,s;
364: int i,j,h,d1,d2;
365:
366: if ( DEG(f1) < bound || DEG(f2) < bound )
367: error("mulsfbm : invalid input");
368:
369: d1 = DEG(COEF(f1)[0]);
370: for ( i = 1; i < bound; i++ )
371: d1 = MAX(DEG(COEF(f1)[i]),d1);
372: d2 = DEG(COEF(f2)[0]);
373: for ( i = 1; i < bound; i++ )
374: d2 = MAX(DEG(COEF(f2)[i]),d2);
375: t = W_UMALLOC(d1+d2);
376: s = W_UMALLOC(d1+d2);
377:
378: for ( i = 0; i < bound; i++ ) {
379: mul = COEF(f2)[i];
380: if ( DEG(mul) >= 0 )
381: for ( j = 0; i+j < bound; j++ ) {
382: if ( COEF(f1)[j] ) {
383: mulsfum(COEF(f1)[j],mul,t);
384: addsfum(t,COEF(fr)[i+j],s);
385: cpyum(s,COEF(fr)[i+j]);
386: }
387: }
388: }
389: DEG(fr) = bound;
390: }
391:
392: /* g += f */
393:
394: void addtosfbm(bound,f,g)
395: int bound;
396: BM f,g;
397: {
398: int i,d1,d2;
399: UM t;
400:
401: d1 = DEG(COEF(f)[0]);
402: for ( i = 1; i < bound; i++ )
403: d1 = MAX(DEG(COEF(f)[i]),d1);
404: d2 = DEG(COEF(g)[0]);
405: for ( i = 1; i < bound; i++ )
406: d2 = MAX(DEG(COEF(g)[i]),d2);
407: t = W_UMALLOC(MAX(d1,d2));
408: for ( i = 0; i < bound; i++ ) {
409: addsfum(COEF(f)[i],COEF(g)[i],t);
410: cpyum(t,COEF(g)[i]);
411: }
412: }
413:
1.3 noro 414: void addsfarray(n,a1,a2)
1.2 noro 415: int n;
416: int *a1,*a2;
417: {
1.3 noro 418: int i;
419:
420: for ( i = 0; i < n; i++, a1++, a2++ )
421: if ( *a1 )
1.5 ! noro 422: *a2 = _ADDSF(*a1,*a2);
1.2 noro 423: }
424:
1.3 noro 425: void mulsfarray_trunc(n,a1,a2,r)
1.2 noro 426: int n;
427: int *a1,*a2,*r;
428: {
1.3 noro 429: int mul,i,j;
430: int *c1,*c2,*cr;
431: int *pc1,*pc2,*pcr;
432:
433: bzero(r,n*sizeof(int));
434: c1 = a1; c2 = a2; cr = r;
435: for ( i = 0; i < n; i++, cr++ ) {
436: if ( mul = *c2++ )
437: for ( j = 0, pc1 = c1, pcr = cr; j+i < n; j++, pc1++, pcr++ )
438: if ( *pc1 )
1.5 ! noro 439: *pcr = _ADDSF(_MULSF(*pc1,mul),*pcr);
1.3 noro 440: }
1.2 noro 441: }
442:
443: void eucsfum(f1,f2,a,b)
444: UM f1,f2,a,b;
445: {
446: UM g1,g2,a1,a2,a3,wm,q,tum;
447: int d,dr;
448:
449: /* XXX */
450: d = DEG(f1) + DEG(f2) + 10;
451: g1 = W_UMALLOC(d); g2 = W_UMALLOC(d); a1 = W_UMALLOC(d);
452: a2 = W_UMALLOC(d); a3 = W_UMALLOC(d); wm = W_UMALLOC(d);
453: q = W_UMALLOC(d);
1.3 noro 454: DEG(a1) = 0; COEF(a1)[0] = _onesf(); DEG(a2) = -1;
1.2 noro 455: cpyum(f1,g1); cpyum(f2,g2);
456: while ( 1 ) {
457: dr = divsfum(g1,g2,q); tum = g1; g1 = g2; g2 = tum;
458: if ( ( DEG(g2) = dr ) == -1 )
459: break;
460: mulsfum(a2,q,wm); subsfum(a1,wm,a3); dr = divsfum(a3,f2,q);
461: tum = a1; a1 = a2; a2 = a3; a3 = tum; DEG(a3) = dr;
462: }
1.3 noro 463: if ( COEF(g1)[0] != _onesf() )
1.2 noro 464: mulssfum(a2,_invsf(COEF(g1)[0]),a);
465: else
466: cpyum(a2,a);
467: mulsfum(a,f1,wm);
468: if ( DEG(wm) >= 0 )
469: COEF(wm)[0] = _subsf(COEF(wm)[0],_onesf());
470: else {
471: DEG(wm) = 0; COEF(wm)[0] = _chsgnsf(_onesf());
472: }
473: divsfum(wm,f2,q); mulssfum(q,_chsgnsf(_onesf()),b);
1.3 noro 474: }
475:
476: void shiftsfum(UM,int,UM);
477:
478: void shiftsflum(n,f,ev)
479: int n;
480: LUM f;
481: int ev;
482: {
483: int d,i,j;
484: UM w,w1;
485: int *coef;
486: int **c;
487:
488: d = f->d;
489: c = f->c;
490: w = W_UMALLOC(n);
491: w1 = W_UMALLOC(n);
492: for ( i = 0; i <= d; i++ ) {
493: coef = c[i];
494: for ( j = n-1; j >= 0 && coef[j] == 0; j-- );
495: if ( j <= 0 )
496: continue;
497: DEG(w) = j; bcopy(coef,COEF(w),(j+1)*sizeof(int));
498: shiftsfum(w,ev,w1);
499: bcopy(COEF(w1),coef,(j+1)*sizeof(int));
500: }
501: }
502:
503: /* f(x) -> g(x) = f(x+a) */
504:
505: void shiftsfum(f,a,g)
506: UM f;
507: int a;
508: UM g;
509: {
510: int n,i;
511: UM pwr,xa,w,t;
512: int *c;
513:
514: n = DEG(f);
515: if ( n <= 0 )
516: cpyum(f,g);
517: else {
518: c = COEF(f);
519:
520: /* g = 0 */
521: DEG(g) = -1;
522:
523: /* pwr = 1 */
524: pwr = W_UMALLOC(n); DEG(pwr) = 0; COEF(pwr)[0] = _onesf();
525:
526: /* xa = x+a */
527: xa = W_UMALLOC(n); DEG(xa) = 1;
528: COEF(xa)[0] = a; COEF(xa)[1] = _onesf();
529:
530: w = W_UMALLOC(n);
531: t = W_UMALLOC(n);
532:
533: /* g += pwr*c[0] */
534: for ( i = 0; i <= n; i++ ) {
535: mulssfum(pwr,c[i],w); addsfum(g,w,t); cpyum(t,g);
536: if ( i < n ) {
537: mulsfum(pwr,xa,t); cpyum(t,pwr);
538: }
539: }
540: }
541: }
542:
1.4 noro 543: /* f(y) -> f(y+a) */
544:
545: void shiftsfbm(bound,f,a)
546: int bound;
547: BM f;
548: int a;
549: {
550: int i,j,d;
551: UM pwr,ya,w,t,s;
552: UM *c;
553:
554: if ( bound <= 0 )
555: return;
556: else {
557: c = COEF(f);
558: d = DEG(c[0]);
559: for ( i = 1; i < bound; i++ )
560: d = MAX(DEG(c[i]),d);
561:
562: w = W_UMALLOC(d);
563: t = W_UMALLOC(d);
564: s = W_UMALLOC(bound);
565:
566: /* pwr = 1 */
567: pwr = W_UMALLOC(bound); DEG(pwr) = 0; COEF(pwr)[0] = _onesf();
568:
569: /* ya = y+a */
570: ya = W_UMALLOC(1); DEG(ya) = 1;
571: COEF(ya)[0] = a; COEF(ya)[1] = _onesf();
572:
573: for ( i = 0; i < bound; i++ ) {
574: /* c[i] does not change */
575: for ( j = 0; j < i; j++ ) {
576: mulssfum(c[i],COEF(pwr)[j],w);
577: addsfum(w,c[j],t); cpyum(t,c[j]);
578: }
579: if ( i < bound-1 ) {
580: mulsfum(pwr,ya,s); cpyum(s,pwr);
581: }
582: }
583: }
584: }
585:
1.3 noro 586: /* clear the body of f */
587:
588: void clearsflum(bound,n,f)
589: int bound,n;
590: LUM f;
591: {
592: int **c;
593: int i;
594:
595: DEG(f) = 0;
596: for ( c = COEF(f), i = 0; i <= n; i++ )
597: bzero(c[i],(bound+1)*sizeof(int));
1.4 noro 598: }
599:
600: void clearsfbm(bound,n,f)
601: int bound,n;
602: BM f;
603: {
604: int i;
605: UM *c;
606:
607: DEG(f) = bound;
608: for ( c = COEF(f), i = 0; i < bound; i++ )
609: clearum(c[i],n);
1.3 noro 610: }
611:
612: /* f += g */
613:
614: void addtosflum(bound,g,f)
615: int bound;
616: LUM g,f;
617: {
618: int dg,i,j;
619: int **cg,**cf;
620:
621: dg = DEG(g);
622: cg = COEF(g);
623: cf = COEF(f);
624: for ( i = 0; i <= dg; i++ )
625: for ( j = 0; j <= bound; j++ )
1.5 ! noro 626: cf[i][j] = _ADDSF(cf[i][j],cg[i][j]);
1.1 noro 627: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>