version 1.29, 2002/11/22 08:44:57 |
version 1.30, 2003/01/15 10:21:17 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/Hgfs.c,v 1.28 2002/11/22 07:32:10 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/Hgfs.c,v 1.29 2002/11/22 08:44:57 noro Exp $ */ |
|
|
#include "ca.h" |
#include "ca.h" |
#include "inline.h" |
#include "inline.h" |
|
|
|
int debug_sfbfctr; |
|
|
void lnfsf(int n,UM p0,UM p1,struct p_pair *list,UM np0,UM np1); |
void lnfsf(int n,UM p0,UM p1,struct p_pair *list,UM np0,UM np1); |
void extractcoefbm(BM f,int dx,UM r); |
void extractcoefbm(BM f,int dx,UM r); |
|
|
Line 609 void sfhensel(int count,P f,V x,V y,int degbound,GFS * |
|
Line 611 void sfhensel(int count,P f,V x,V y,int degbound,GFS * |
|
|
|
q = W_UMALLOC(dx); |
q = W_UMALLOC(dx); |
rlist = MLALLOC(fn); rlist->n = fn; rlist->bound = bound; |
rlist = MLALLOC(fn); rlist->n = fn; rlist->bound = bound; |
fprintf(asir_out,"%d candidates\n",fn); |
if ( debug_sfbfctr ) |
|
fprintf(asir_out,"%d candidates\n",fn); |
init_eg(&eg_hensel); |
init_eg(&eg_hensel); |
for ( i = 0; i < fn-1; i++ ) { |
for ( i = 0; i < fn-1; i++ ) { |
fprintf(asir_out,"deg(fm) = %d, deg(gm[%d]) = %d\n", |
if ( debug_sfbfctr ) |
|
fprintf(asir_out,"deg(fm) = %d, deg(gm[%d]) = %d\n", |
DEG(fm),i,DEG(gm[i])); |
DEG(fm),i,DEG(gm[i])); |
init_eg(&eg_hensel_t); |
init_eg(&eg_hensel_t); |
get_eg(&tmp0); |
get_eg(&tmp0); |
Line 624 void sfhensel(int count,P f,V x,V y,int degbound,GFS * |
|
Line 628 void sfhensel(int count,P f,V x,V y,int degbound,GFS * |
|
cpyum(hm,fm); |
cpyum(hm,fm); |
get_eg(&tmp1); add_eg(&eg_hensel_t,&tmp0,&tmp1); |
get_eg(&tmp1); add_eg(&eg_hensel_t,&tmp0,&tmp1); |
add_eg(&eg_hensel,&tmp0,&tmp1); |
add_eg(&eg_hensel,&tmp0,&tmp1); |
print_eg("Hensel",&eg_hensel_t); |
if ( debug_sfbfctr) { |
|
print_eg("Hensel",&eg_hensel_t); |
|
fprintf(asir_out,"\n"); |
|
} |
|
} |
|
if ( debug_sfbfctr) { |
|
print_eg("Hensel total",&eg_hensel); |
fprintf(asir_out,"\n"); |
fprintf(asir_out,"\n"); |
} |
} |
print_eg("Hensel total",&eg_hensel); |
|
fprintf(asir_out,"\n"); |
|
/* finally, fl must be the lift of gm[fn-1] */ |
/* finally, fl must be the lift of gm[fn-1] */ |
rlist->c[i] = fl; |
rlist->c[i] = fl; |
|
|
Line 761 void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp) |
|
Line 769 void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp) |
|
wa = W_UMALLOC(2*dx); wb = W_UMALLOC(2*dx); /* XXX */ |
wa = W_UMALLOC(2*dx); wb = W_UMALLOC(2*dx); /* XXX */ |
eucsfum(w1,w2,wa,wb); |
eucsfum(w1,w2,wa,wb); |
|
|
fprintf(stderr,"dy=%d\n",dy); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"dy=%d\n",dy); |
for ( k = 1; k <= dy; k++ ) { |
for ( k = 1; k <= dy; k++ ) { |
fprintf(stderr,"."); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"."); |
|
|
/* at this point, f = gk*hk mod y^k */ |
/* at this point, f = gk*hk mod y^k */ |
|
|
Line 819 void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp) |
|
Line 829 void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp) |
|
cpyum(wg1,COEF(gk)[k]); |
cpyum(wg1,COEF(gk)[k]); |
cpyum(wh1,COEF(hk)[k]); |
cpyum(wh1,COEF(hk)[k]); |
} |
} |
fprintf(stderr,"\n"); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"\n"); |
*gp = gk; |
*gp = gk; |
DEG(f) = dy; |
DEG(f) = dy; |
for ( i = 0; i <= dy; i++ ) |
for ( i = 0; i <= dy; i++ ) |
Line 865 void sfexgcd_by_hensel(BM g,BM h,int dy,BM *ap,BM *bp) |
|
Line 876 void sfexgcd_by_hensel(BM g,BM h,int dy,BM *ap,BM *bp) |
|
mulsfbm(a,g,c); mulsfbm(b,h,wz0); addtosfbm(wz0,c); |
mulsfbm(a,g,c); mulsfbm(b,h,wz0); addtosfbm(wz0,c); |
COEF(COEF(c)[0])[0] = 0; |
COEF(COEF(c)[0])[0] = 0; |
|
|
fprintf(stderr,"dy=%d\n",dy); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"dy=%d\n",dy); |
for ( k = 1; k <= dy; k++ ) { |
for ( k = 1; k <= dy; k++ ) { |
fprintf(stderr,"."); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"."); |
|
|
/* at this point, a*g+b*h = 1 mod y^k, c = a*g+b*h-1 */ |
/* at this point, a*g+b*h = 1 mod y^k, c = a*g+b*h-1 */ |
|
|
Line 906 void sfexgcd_by_hensel(BM g,BM h,int dy,BM *ap,BM *bp) |
|
Line 919 void sfexgcd_by_hensel(BM g,BM h,int dy,BM *ap,BM *bp) |
|
cpyum(wa1,COEF(a)[k]); |
cpyum(wa1,COEF(a)[k]); |
cpyum(wb1,COEF(b)[k]); |
cpyum(wb1,COEF(b)[k]); |
} |
} |
fprintf(stderr,"\n"); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"\n"); |
DEG(a) = dy; |
DEG(a) = dy; |
DEG(b) = dy; |
DEG(b) = dy; |
*ap = a; |
*ap = a; |
Line 1204 void sfdtest(P f,ML list,V x,V y,DCP *dcp) |
|
Line 1218 void sfdtest(P f,ML list,V x,V y,DCP *dcp) |
|
} |
} |
} |
} |
|
|
fprintf(stderr,"np = %d\n",np); |
if ( debug_sfbfctr) |
|
fprintf(stderr,"np = %d\n",np); |
dtok = 0; |
dtok = 0; |
for ( g = f, k = 1, dcf = dcf0 = 0, win[0] = 1, --np, z = 0; ; z++ ) { |
for ( g = f, k = 1, dcf = dcf0 = 0, win[0] = 1, --np, z = 0; ; z++ ) { |
if ( !(z % 1000) ) fprintf(stderr,"."); |
if ( debug_sfbfctr && !(z % 1000) ) fprintf(stderr,"."); |
dt = sfdegtest(dy,bound,d1c,k,win); |
dt = sfdegtest(dy,bound,d1c,k,win); |
if ( dt ) |
if ( dt ) |
dtok++; |
dtok++; |
Line 1272 void sfdtest(P f,ML list,V x,V y,DCP *dcp) |
|
Line 1287 void sfdtest(P f,ML list,V x,V y,DCP *dcp) |
|
for ( i = 0, ++k; i < k; i++ ) |
for ( i = 0, ++k; i < k; i++ ) |
win[i] = i + 1; |
win[i] = i + 1; |
} |
} |
fprintf(stderr,"total %d, omitted by degtest %d\n",z,z-dtok); |
if ( debug_sfbfctr ) |
|
fprintf(stderr,"total %d, omitted by degtest %d\n",z,z-dtok); |
NEXTDC(dcf0,dcf); COEF(dcf) = g; |
NEXTDC(dcf0,dcf); COEF(dcf) = g; |
DEG(dcf) = ONE; NEXT(dcf) = 0; *dcp = dcf0; |
DEG(dcf) = ONE; NEXT(dcf) = 0; *dcp = dcf0; |
} |
} |