version 1.12, 2002/01/13 07:11:46 |
version 1.15, 2002/12/18 06:15:40 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/Mgfs.c,v 1.11 2001/10/09 01:36:10 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/Mgfs.c,v 1.14 2002/09/27 08:40:49 noro Exp $ */ |
|
|
#include "ca.h" |
#include "ca.h" |
|
#include "inline.h" |
|
|
|
extern int current_gfs_p; |
extern int up_kara_mag, current_gfs_q1; |
extern int up_kara_mag, current_gfs_q1; |
extern int *current_gfs_plus1; |
extern int *current_gfs_plus1; |
|
|
Line 21 INLINE int _ADDSF(int a,int b) |
|
Line 23 INLINE int _ADDSF(int a,int b) |
|
return a; |
return a; |
|
|
a = IFTOF(a); b = IFTOF(b); |
a = IFTOF(a); b = IFTOF(b); |
|
|
|
if ( !current_gfs_ntoi ) { |
|
a = a+b-current_gfs_q; |
|
if ( a == 0 ) |
|
return 0; |
|
else { |
|
if ( a < 0 ) |
|
a += current_gfs_q; |
|
return FTOIF(a); |
|
} |
|
} |
|
|
if ( a > b ) { |
if ( a > b ) { |
/* tab[a]+tab[b] = tab[b](tab[a-b]+1) */ |
/* tab[a]+tab[b] = tab[b](tab[a-b]+1) */ |
a = current_gfs_plus1[a-b]; |
a = current_gfs_plus1[a-b]; |
Line 48 INLINE int _ADDSF(int a,int b) |
|
Line 62 INLINE int _ADDSF(int a,int b) |
|
|
|
INLINE int _MULSF(int a,int b) |
INLINE int _MULSF(int a,int b) |
{ |
{ |
|
int c; |
|
|
if ( !a || !b ) |
if ( !a || !b ) |
return 0; |
return 0; |
else { |
else if ( !current_gfs_ntoi ) { |
|
a = IFTOF(a); b = IFTOF(b); |
|
DMAR(a,b,0,current_gfs_q,c); |
|
return FTOIF(c); |
|
} else { |
a = IFTOF(a) + IFTOF(b); |
a = IFTOF(a) + IFTOF(b); |
if ( a >= current_gfs_q1 ) |
if ( a >= current_gfs_q1 ) |
a -= current_gfs_q1; |
a -= current_gfs_q1; |
Line 300 void diffsfum(UM f,UM fd) |
|
Line 320 void diffsfum(UM f,UM fd) |
|
|
|
for ( i = DEG(f), dp = COEF(fd)+i-1, sp = COEF(f)+i; |
for ( i = DEG(f), dp = COEF(fd)+i-1, sp = COEF(f)+i; |
i >= 1; i--, dp--, sp-- ) { |
i >= 1; i--, dp--, sp-- ) { |
*dp = _MULSF(*sp,_itosf(i)); |
*dp = _MULSF(*sp,_itosf(i%current_gfs_p)); |
} |
} |
degum(fd,DEG(f) - 1); |
degum(fd,DEG(f) - 1); |
} |
} |
Line 671 void sfmintdeg(VL vl,P fx,int dy,int c,P *fr) |
|
Line 691 void sfmintdeg(VL vl,P fx,int dy,int c,P *fr) |
|
|
|
/* create the head coeff */ |
/* create the head coeff */ |
for ( l = 0, k = dxdy-dy; l < dy; l++, k++ ) { |
for ( l = 0, k = dxdy-dy; l < dy; l++, k++ ) { |
if ( prev[k] ) { |
iftogfs(prev[k],&s); |
u = IFTOF(prev[k]); |
|
MKGFS(u,s); |
|
} else |
|
s = 0; |
|
COEF(h)[l] = (Num)s; |
COEF(h)[l] = (Num)s; |
} |
} |
for ( l = dy-1; l >= 0 && !COEF(h)[l]; l--); |
for ( l = dy-1; l >= 0 && !COEF(h)[l]; l--); |
Line 711 void sfmintdeg(VL vl,P fx,int dy,int c,P *fr) |
|
Line 727 void sfmintdeg(VL vl,P fx,int dy,int c,P *fr) |
|
for ( k = j = 0; k <= d; k++ ) |
for ( k = j = 0; k <= d; k++ ) |
for ( i = 0; i <= k; i++, j++ ) |
for ( i = 0; i <= k; i++, j++ ) |
if ( hist[j] ) { |
if ( hist[j] ) { |
u = IFTOF(hist[j]); |
iftogfs(hist[j],&s); |
MKGFS(u,s); |
|
/* mono = s*x^(k-i)*y^i */ |
/* mono = s*x^(k-i)*y^i */ |
create_bmono((P)s,x,k-i,y,i,&mono); |
create_bmono((P)s,x,k-i,y,i,&mono); |
addp(vl,f,mono,&f1); |
addp(vl,f,mono,&f1); |