rem
stringlengths 0
274k
| add
stringlengths 0
169k
| context
stringlengths 9
471k
|
---|---|---|
av=avma; uftot=0; | uftot = NULL; | thueinit(GEN poly, long flag, long prec){ GEN thueres,ALH,csts,c0; long av,tetpil,k,st; double d,dr; av=avma; uftot=0; if (checktnf(poly)) { uftot=(GEN)poly[2]; poly=(GEN)poly[1]; } else if (typ(poly)!=t_POL) err(notpoler,"thueinit"); if (degpol(poly)<=2) err(talker,"invalid polynomial in thue (need deg>2)"); if (!gisirreducible(poly)) err(redpoler,"thueinit"); st=sturm(poly); if (st) { dr=(double)((st+lgef(poly)-5)>>1); d=(double)degpol(poly); d=d*(d-1)*(d-2); /* Try to guess the precision by approximating Baker's bound. * Note that the guess is most of the time pretty generous, * ie 10 to 30 decimal digits above what is *really* necessary. * Note that the limiting step is the reduction. See paper. */ Prec=3 + (long)((5.83 + (dr+4)*5 + log(fact(dr+3)) + (dr+3)*log(dr+2) + (dr+3)*log(d) + log(log(2*d*(dr+2))) + (dr+1)) / 10.); ConstPrec=4; if (Prec<prec) Prec = prec; if (!checktnf(poly)) inithue(poly,flag); thueres=cgetg(8,t_VEC); thueres[1]=(long)poly; thueres[2]=(long)uftot; thueres[3]=(long)roo; Compute_Fund_Units(gmael(uftot,8,5)); ALH=cgetg(r+1,t_COL); for (k=1; k<=r; k++) ALH[k]=(long)Logarithmic_Height(k); thueres[4]=(long)ALH; thueres[5]=(long)MatFU; T_A_Matrices(); thueres[6]=(long)A; csts=cgetg(7,t_VEC); csts[1]=(long)c1; csts[2]=(long)c2; csts[3]=(long)halpha; csts[4]=(long)x0; csts[5]=(long)eps3; csts[6]=(long)stoi(Prec); thueres[7]=(long)csts; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres)); } thueres=cgetg(3,t_VEC); c0=gun; Prec=4; roo=roots(poly,Prec); for (k=1; k<lg(roo); k++) c0=gmul(c0, gimag((GEN)roo[k])); c0=ginv(gabs(c0,Prec)); thueres[1]=(long)poly; thueres[2]=(long)c0; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres));} |
thueres[7]=(long)csts; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres)); | thueres[7]=(long)csts; return gerepilecopy(av,thueres); | thueinit(GEN poly, long flag, long prec){ GEN thueres,ALH,csts,c0; long av,tetpil,k,st; double d,dr; av=avma; uftot=0; if (checktnf(poly)) { uftot=(GEN)poly[2]; poly=(GEN)poly[1]; } else if (typ(poly)!=t_POL) err(notpoler,"thueinit"); if (degpol(poly)<=2) err(talker,"invalid polynomial in thue (need deg>2)"); if (!gisirreducible(poly)) err(redpoler,"thueinit"); st=sturm(poly); if (st) { dr=(double)((st+lgef(poly)-5)>>1); d=(double)degpol(poly); d=d*(d-1)*(d-2); /* Try to guess the precision by approximating Baker's bound. * Note that the guess is most of the time pretty generous, * ie 10 to 30 decimal digits above what is *really* necessary. * Note that the limiting step is the reduction. See paper. */ Prec=3 + (long)((5.83 + (dr+4)*5 + log(fact(dr+3)) + (dr+3)*log(dr+2) + (dr+3)*log(d) + log(log(2*d*(dr+2))) + (dr+1)) / 10.); ConstPrec=4; if (Prec<prec) Prec = prec; if (!checktnf(poly)) inithue(poly,flag); thueres=cgetg(8,t_VEC); thueres[1]=(long)poly; thueres[2]=(long)uftot; thueres[3]=(long)roo; Compute_Fund_Units(gmael(uftot,8,5)); ALH=cgetg(r+1,t_COL); for (k=1; k<=r; k++) ALH[k]=(long)Logarithmic_Height(k); thueres[4]=(long)ALH; thueres[5]=(long)MatFU; T_A_Matrices(); thueres[6]=(long)A; csts=cgetg(7,t_VEC); csts[1]=(long)c1; csts[2]=(long)c2; csts[3]=(long)halpha; csts[4]=(long)x0; csts[5]=(long)eps3; csts[6]=(long)stoi(Prec); thueres[7]=(long)csts; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres)); } thueres=cgetg(3,t_VEC); c0=gun; Prec=4; roo=roots(poly,Prec); for (k=1; k<lg(roo); k++) c0=gmul(c0, gimag((GEN)roo[k])); c0=ginv(gabs(c0,Prec)); thueres[1]=(long)poly; thueres[2]=(long)c0; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres));} |
tetpil=avma; return gerepile(av,tetpil,gcopy(thueres)); | return gerepilecopy(av,thueres); | thueinit(GEN poly, long flag, long prec){ GEN thueres,ALH,csts,c0; long av,tetpil,k,st; double d,dr; av=avma; uftot=0; if (checktnf(poly)) { uftot=(GEN)poly[2]; poly=(GEN)poly[1]; } else if (typ(poly)!=t_POL) err(notpoler,"thueinit"); if (degpol(poly)<=2) err(talker,"invalid polynomial in thue (need deg>2)"); if (!gisirreducible(poly)) err(redpoler,"thueinit"); st=sturm(poly); if (st) { dr=(double)((st+lgef(poly)-5)>>1); d=(double)degpol(poly); d=d*(d-1)*(d-2); /* Try to guess the precision by approximating Baker's bound. * Note that the guess is most of the time pretty generous, * ie 10 to 30 decimal digits above what is *really* necessary. * Note that the limiting step is the reduction. See paper. */ Prec=3 + (long)((5.83 + (dr+4)*5 + log(fact(dr+3)) + (dr+3)*log(dr+2) + (dr+3)*log(d) + log(log(2*d*(dr+2))) + (dr+1)) / 10.); ConstPrec=4; if (Prec<prec) Prec = prec; if (!checktnf(poly)) inithue(poly,flag); thueres=cgetg(8,t_VEC); thueres[1]=(long)poly; thueres[2]=(long)uftot; thueres[3]=(long)roo; Compute_Fund_Units(gmael(uftot,8,5)); ALH=cgetg(r+1,t_COL); for (k=1; k<=r; k++) ALH[k]=(long)Logarithmic_Height(k); thueres[4]=(long)ALH; thueres[5]=(long)MatFU; T_A_Matrices(); thueres[6]=(long)A; csts=cgetg(7,t_VEC); csts[1]=(long)c1; csts[2]=(long)c2; csts[3]=(long)halpha; csts[4]=(long)x0; csts[5]=(long)eps3; csts[6]=(long)stoi(Prec); thueres[7]=(long)csts; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres)); } thueres=cgetg(3,t_VEC); c0=gun; Prec=4; roo=roots(poly,Prec); for (k=1; k<lg(roo); k++) c0=gmul(c0, gimag((GEN)roo[k])); c0=ginv(gabs(c0,Prec)); thueres[1]=(long)poly; thueres[2]=(long)c0; tetpil=avma; return gerepile(av,tetpil,gcopy(thueres));} |
unsigned8 b[NUM_FIELDS]; | uint8_t b[NUM_FIELDS]; | command_port(FTPD_SessionInfo_t *info, char const *args){ enum { NUM_FIELDS = 6 }; unsigned int a[NUM_FIELDS]; int n; close_data_socket(info); n = sscanf(args, "%u,%u,%u,%u,%u,%u", a+0, a+1, a+2, a+3, a+4, a+5); if(NUM_FIELDS == n) { int i; unsigned8 b[NUM_FIELDS]; for(i = 0; i < NUM_FIELDS; ++i) { if(a[i] > 255) break; b[i] = (unsigned8)a[i]; } if(i == NUM_FIELDS) { /* Note: while it contradicts with RFC959, we don't allow PORT command * to specify IP address different than those of the originating client * for the sake of safety. */ unsigned32 const *ip = (unsigned32 *)b; if(*ip == info->def_addr.sin_addr.s_addr) { info->data_addr.sin_addr.s_addr = *ip; info->data_addr.sin_port = *(unsigned16 *)(b + 4); info->data_addr.sin_family = AF_INET; memset(info->data_addr.sin_zero, 0, sizeof(info->data_addr.sin_zero)); info->use_default = 0; send_reply(info, 200, "PORT command successful."); return; /* success */ } else { send_reply(info, 425, "Address doesn't match peer's IP."); return; } } } send_reply(info, 501, "Syntax error.");} |
b[i] = (unsigned8)a[i]; | b[i] = (uint8_t)a[i]; | command_port(FTPD_SessionInfo_t *info, char const *args){ enum { NUM_FIELDS = 6 }; unsigned int a[NUM_FIELDS]; int n; close_data_socket(info); n = sscanf(args, "%u,%u,%u,%u,%u,%u", a+0, a+1, a+2, a+3, a+4, a+5); if(NUM_FIELDS == n) { int i; unsigned8 b[NUM_FIELDS]; for(i = 0; i < NUM_FIELDS; ++i) { if(a[i] > 255) break; b[i] = (unsigned8)a[i]; } if(i == NUM_FIELDS) { /* Note: while it contradicts with RFC959, we don't allow PORT command * to specify IP address different than those of the originating client * for the sake of safety. */ unsigned32 const *ip = (unsigned32 *)b; if(*ip == info->def_addr.sin_addr.s_addr) { info->data_addr.sin_addr.s_addr = *ip; info->data_addr.sin_port = *(unsigned16 *)(b + 4); info->data_addr.sin_family = AF_INET; memset(info->data_addr.sin_zero, 0, sizeof(info->data_addr.sin_zero)); info->use_default = 0; send_reply(info, 200, "PORT command successful."); return; /* success */ } else { send_reply(info, 425, "Address doesn't match peer's IP."); return; } } } send_reply(info, 501, "Syntax error.");} |
unsigned32 const *ip = (unsigned32 *)b; | uint32_t const *ip = (uint32_t *)b; | command_port(FTPD_SessionInfo_t *info, char const *args){ enum { NUM_FIELDS = 6 }; unsigned int a[NUM_FIELDS]; int n; close_data_socket(info); n = sscanf(args, "%u,%u,%u,%u,%u,%u", a+0, a+1, a+2, a+3, a+4, a+5); if(NUM_FIELDS == n) { int i; unsigned8 b[NUM_FIELDS]; for(i = 0; i < NUM_FIELDS; ++i) { if(a[i] > 255) break; b[i] = (unsigned8)a[i]; } if(i == NUM_FIELDS) { /* Note: while it contradicts with RFC959, we don't allow PORT command * to specify IP address different than those of the originating client * for the sake of safety. */ unsigned32 const *ip = (unsigned32 *)b; if(*ip == info->def_addr.sin_addr.s_addr) { info->data_addr.sin_addr.s_addr = *ip; info->data_addr.sin_port = *(unsigned16 *)(b + 4); info->data_addr.sin_family = AF_INET; memset(info->data_addr.sin_zero, 0, sizeof(info->data_addr.sin_zero)); info->use_default = 0; send_reply(info, 200, "PORT command successful."); return; /* success */ } else { send_reply(info, 425, "Address doesn't match peer's IP."); return; } } } send_reply(info, 501, "Syntax error.");} |
info->data_addr.sin_port = *(unsigned16 *)(b + 4); | info->data_addr.sin_port = *(uint16_t *)(b + 4); | command_port(FTPD_SessionInfo_t *info, char const *args){ enum { NUM_FIELDS = 6 }; unsigned int a[NUM_FIELDS]; int n; close_data_socket(info); n = sscanf(args, "%u,%u,%u,%u,%u,%u", a+0, a+1, a+2, a+3, a+4, a+5); if(NUM_FIELDS == n) { int i; unsigned8 b[NUM_FIELDS]; for(i = 0; i < NUM_FIELDS; ++i) { if(a[i] > 255) break; b[i] = (unsigned8)a[i]; } if(i == NUM_FIELDS) { /* Note: while it contradicts with RFC959, we don't allow PORT command * to specify IP address different than those of the originating client * for the sake of safety. */ unsigned32 const *ip = (unsigned32 *)b; if(*ip == info->def_addr.sin_addr.s_addr) { info->data_addr.sin_addr.s_addr = *ip; info->data_addr.sin_port = *(unsigned16 *)(b + 4); info->data_addr.sin_family = AF_INET; memset(info->data_addr.sin_zero, 0, sizeof(info->data_addr.sin_zero)); info->use_default = 0; send_reply(info, 200, "PORT command successful."); return; /* success */ } else { send_reply(info, 425, "Address doesn't match peer's IP."); return; } } } send_reply(info, 501, "Syntax error.");} |
if (!signe(x)) { y=cgetr(3); y[1]=x[1]; y[2]=0; return y; } | if (!signe(x)) return realzero_bit(expo(x)); | mpsin(GEN x){ long mod8,av,tetpil; GEN y,p1; if (typ(x)!=t_REAL) err(typeer,"mpsin"); if (!signe(x)) { y=cgetr(3); y[1]=x[1]; y[2]=0; return y; } av=avma; p1=mpsc1(x,&mod8); tetpil=avma; switch(mod8) { case 0: case 6: y=mpaut(p1); break; case 1: case 5: y=addsr(1,p1); break; case 2: case 4: y=mpaut(p1); setsigne(y,-signe(y)); break; default: /* case 3: case 7: */ y=subsr(-1,p1); break; } return gerepile(av,tetpil,y);} |
testx(GEN bnfz, GEN bnf, GEN X, GEN module, GEN subgroup, GEN vecMsup, GEN vecWB, long g, GEN U) | testx(GEN bnfz, GEN bnr, GEN X, GEN subgroup, GEN vecMsup, GEN vecWB, long g, GEN U) | testx(GEN bnfz, GEN bnf, GEN X, GEN module, GEN subgroup, GEN vecMsup, GEN vecWB, long g, GEN U){ long i,l,lX; GEN be,polrelbe,p1,nf; if (gcmp0(X)) return NULL; lX = lg(X); for (i=dv+1; i<lX; i++) if (gcmp0((GEN)X[i])) return NULL; l = lg(vecMsup); for (i=1; i<l; i++) if (gcmp0(FpV_red(gmul((GEN)vecMsup[i],X), gell))) return NULL; be = gun; for (i=1; i<lX; i++) be = gmul(be, powgi((GEN)vecWB[i], (GEN)X[i])); if (DEBUGLEVEL>1) fprintferr("reducing beta = %Z\n",be); be = reducebeta(bnfz, be); if (DEBUGLEVEL>1) fprintferr("beta reduced = %Z\n",be); nf = (GEN)bnf[7]; polrelbe = computepolrelbeta((GEN)nf[1],be,g,U); p1 = unifpol(nf,polrelbe,0); l = lg(p1); /* lift to Q rational coeffs */ for (i=2; i<l; i++) if (isnfscalar((GEN)p1[i])) polrelbe[i] = mael(p1,i,1); p1 = denom(gtovec(p1)); polrelbe = rescale_pol(polrelbe,p1); if (DEBUGLEVEL>1) fprintferr("polrelbe = %Z\n",polrelbe); p1 = rnfconductor(bnf,polrelbe,0); if (!gegal((GEN)p1[1],module) || !gegal((GEN)p1[3],subgroup)) return NULL; return polrelbe;} |
be = gun; for (i=1; i<lX; i++) be = gmul(be, powgi((GEN)vecWB[i], (GEN)X[i])); | be = factorback(vecWB, X); | testx(GEN bnfz, GEN bnf, GEN X, GEN module, GEN subgroup, GEN vecMsup, GEN vecWB, long g, GEN U){ long i,l,lX; GEN be,polrelbe,p1,nf; if (gcmp0(X)) return NULL; lX = lg(X); for (i=dv+1; i<lX; i++) if (gcmp0((GEN)X[i])) return NULL; l = lg(vecMsup); for (i=1; i<l; i++) if (gcmp0(FpV_red(gmul((GEN)vecMsup[i],X), gell))) return NULL; be = gun; for (i=1; i<lX; i++) be = gmul(be, powgi((GEN)vecWB[i], (GEN)X[i])); if (DEBUGLEVEL>1) fprintferr("reducing beta = %Z\n",be); be = reducebeta(bnfz, be); if (DEBUGLEVEL>1) fprintferr("beta reduced = %Z\n",be); nf = (GEN)bnf[7]; polrelbe = computepolrelbeta((GEN)nf[1],be,g,U); p1 = unifpol(nf,polrelbe,0); l = lg(p1); /* lift to Q rational coeffs */ for (i=2; i<l; i++) if (isnfscalar((GEN)p1[i])) polrelbe[i] = mael(p1,i,1); p1 = denom(gtovec(p1)); polrelbe = rescale_pol(polrelbe,p1); if (DEBUGLEVEL>1) fprintferr("polrelbe = %Z\n",polrelbe); p1 = rnfconductor(bnf,polrelbe,0); if (!gegal((GEN)p1[1],module) || !gegal((GEN)p1[3],subgroup)) return NULL; return polrelbe;} |
nf = (GEN)bnf[7]; | nf = checknf(bnr); | testx(GEN bnfz, GEN bnf, GEN X, GEN module, GEN subgroup, GEN vecMsup, GEN vecWB, long g, GEN U){ long i,l,lX; GEN be,polrelbe,p1,nf; if (gcmp0(X)) return NULL; lX = lg(X); for (i=dv+1; i<lX; i++) if (gcmp0((GEN)X[i])) return NULL; l = lg(vecMsup); for (i=1; i<l; i++) if (gcmp0(FpV_red(gmul((GEN)vecMsup[i],X), gell))) return NULL; be = gun; for (i=1; i<lX; i++) be = gmul(be, powgi((GEN)vecWB[i], (GEN)X[i])); if (DEBUGLEVEL>1) fprintferr("reducing beta = %Z\n",be); be = reducebeta(bnfz, be); if (DEBUGLEVEL>1) fprintferr("beta reduced = %Z\n",be); nf = (GEN)bnf[7]; polrelbe = computepolrelbeta((GEN)nf[1],be,g,U); p1 = unifpol(nf,polrelbe,0); l = lg(p1); /* lift to Q rational coeffs */ for (i=2; i<l; i++) if (isnfscalar((GEN)p1[i])) polrelbe[i] = mael(p1,i,1); p1 = denom(gtovec(p1)); polrelbe = rescale_pol(polrelbe,p1); if (DEBUGLEVEL>1) fprintferr("polrelbe = %Z\n",polrelbe); p1 = rnfconductor(bnf,polrelbe,0); if (!gegal((GEN)p1[1],module) || !gegal((GEN)p1[3],subgroup)) return NULL; return polrelbe;} |
p1 = rnfconductor(bnf,polrelbe,0); if (!gegal((GEN)p1[1],module) || !gegal((GEN)p1[3],subgroup)) return NULL; | p1 = rnfnormgroup(bnr,polrelbe); if (!gegal(p1,subgroup)) return NULL; | testx(GEN bnfz, GEN bnf, GEN X, GEN module, GEN subgroup, GEN vecMsup, GEN vecWB, long g, GEN U){ long i,l,lX; GEN be,polrelbe,p1,nf; if (gcmp0(X)) return NULL; lX = lg(X); for (i=dv+1; i<lX; i++) if (gcmp0((GEN)X[i])) return NULL; l = lg(vecMsup); for (i=1; i<l; i++) if (gcmp0(FpV_red(gmul((GEN)vecMsup[i],X), gell))) return NULL; be = gun; for (i=1; i<lX; i++) be = gmul(be, powgi((GEN)vecWB[i], (GEN)X[i])); if (DEBUGLEVEL>1) fprintferr("reducing beta = %Z\n",be); be = reducebeta(bnfz, be); if (DEBUGLEVEL>1) fprintferr("beta reduced = %Z\n",be); nf = (GEN)bnf[7]; polrelbe = computepolrelbeta((GEN)nf[1],be,g,U); p1 = unifpol(nf,polrelbe,0); l = lg(p1); /* lift to Q rational coeffs */ for (i=2; i<l; i++) if (isnfscalar((GEN)p1[i])) polrelbe[i] = mael(p1,i,1); p1 = denom(gtovec(p1)); polrelbe = rescale_pol(polrelbe,p1); if (DEBUGLEVEL>1) fprintferr("polrelbe = %Z\n",polrelbe); p1 = rnfconductor(bnf,polrelbe,0); if (!gegal((GEN)p1[1],module) || !gegal((GEN)p1[3],subgroup)) return NULL; return polrelbe;} |
const int pk = _pk(p,k), L = lg(tabaall)-1, lz = pk - L; | const int pk = u_pow(p,k), L = lg(tabaall)-1, lz = pk - L; | extendtabs(GEN N, int p, int k){ const int pk = _pk(p,k), L = lg(tabaall)-1, lz = pk - L; const ulong ltab = (NBITSN/kglob)+2; if (lz <= 0) { if (tabcyc[pk]==0) filltabs(N,p,k,ltab); return; } extend((GEN*)&tabaall, lz); extend((GEN*)&tabtall, lz); extend((GEN*)&tabcyc, lz); extend(&tabefin, lz); extend(&tabE, lz); extend(&tabTH, lz); extend(&tabeta, lz); extend(&sgt, lz); extend(&ctsgt, lz); filltabs(N,p,k, ltab);} |
extend(&tabefin, lz); | extendtabs(GEN N, int p, int k){ const int pk = _pk(p,k), L = lg(tabaall)-1, lz = pk - L; const ulong ltab = (NBITSN/kglob)+2; if (lz <= 0) { if (tabcyc[pk]==0) filltabs(N,p,k,ltab); return; } extend((GEN*)&tabaall, lz); extend((GEN*)&tabtall, lz); extend((GEN*)&tabcyc, lz); extend(&tabefin, lz); extend(&tabE, lz); extend(&tabTH, lz); extend(&tabeta, lz); extend(&sgt, lz); extend(&ctsgt, lz); filltabs(N,p,k, ltab);} |
|
pushtmatrix((SDL_svg_context *)closure); | pushtmatrix(c); c->minx = HUGE; c->miny = HUGE; c->maxx = -HUGE; c->maxy = -HUGE; | static svg_status_t _SDL_SVG_BeginElement (void *closure){ dprintf("svg_BeginElement\n"); pushtmatrix((SDL_svg_context *)closure); return SVG_STATUS_SUCCESS;} |
_extremes(c, x1, y1); _extremes(c, x2, y2); _extremes(c, x3, y3); | _SDL_SVG_CurveTo (void *closure, double x1, double y1, double x2, double y2, double x3, double y3){SDL_svg_context *c=closure;IPoint p1,p2,p3; dprintf("svg_CurveTo (x1=%5.5f, y1=%5.5f, x2=%5.5f, y2=%5.5f, x3=%5.5f, y3=%5.5f)\n", x1,y1,x2,y2,x3,y3); if(!c->path || !c->numpoints) return SVG_STATUS_INVALID_CALL; p1 = FixCoords(c, (IPoint) {x1, y1}); p2 = FixCoords(c, (IPoint) {x2, y2}); p3 = FixCoords(c, (IPoint) {x3, y3}); _AddIPoint(c, (IPoint) {p1.x, p1.y}, TAG_CONTROL3); _AddIPoint(c, (IPoint) {p2.x, p2.y}, TAG_CONTROL3); _AddIPoint(c, (IPoint) {p3.x, p3.y}, TAG_ONPATH); c->at = (IPoint) {x3, y3}; return SVG_STATUS_SUCCESS;} |
|
_extremes(c, x, y); | _SDL_SVG_LineTo (void *closure, double x, double y){SDL_svg_context *c=closure; dprintf("svg_LineTo (x=%5.5f, y=%5.5f)\n",x,y); _AddIPoint(c, FixCoords(c, (IPoint) {x, y}), TAG_ONPATH); c->at = (IPoint) {x, y}; return SVG_STATUS_SUCCESS;} |
|
_extremes(c, x, y); | _SDL_SVG_MoveTo (void *closure, double x, double y){SDL_svg_context *c=closure; dprintf("svg_MoveTo (x=%5.5f, y=%5.5f)\n",x,y); if(c->numpoints && needs_path_stop(c)) _AddPathStop(c, 0); _AddIPoint(c, FixCoords(c, (IPoint) {x, y}), TAG_ONPATH); c->at = (IPoint) {x, y}; return SVG_STATUS_SUCCESS;} |
|
_extremes(c, x1, y1); _extremes(c, x2, y2); | _SDL_SVG_QuadraticCurveTo (void *closure, double x1, double y1, double x2, double y2){SDL_svg_context *c=closure;IPoint p1,p2; dprintf("svg_QuadraticCurveTo (x1=%5.5f, y1=%5.5f, x2=%5.5f, y2=%5.5f)\n", x1,y1,x2,y2); if(!c->path || !c->numpoints) return SVG_STATUS_INVALID_CALL; p1 = FixCoords(c, (IPoint) {x1, y1}); p2 = FixCoords(c, (IPoint) {x2, y2}); _AddIPoint(c, (IPoint) {p1.x, p1.y}, TAG_CONTROL2); _AddIPoint(c, (IPoint) {p2.x, p2.y}, TAG_ONPATH); c->at = (IPoint) {x2, y2}; return SVG_STATUS_SUCCESS;} |
|
_extremes(c, x1, y1); _extremes(c, x2, y2); | _SDL_SVG_RenderRect (void *closure, svg_length_t *x_len, svg_length_t *y_len, svg_length_t *width_len, svg_length_t *height_len, svg_length_t *rx_len, svg_length_t *ry_len){SDL_svg_context *c=closure;float x1,y1;float x2,y2; dprintf("svg_RenderRect\n"); x1 = x_len->value; y1 = y_len->value; x2 = x1 + width_len->value; y2 = y1 + height_len->value; _AddIPoint(c, FixCoords(c, (IPoint) {x1, y1}), TAG_ONPATH); _AddIPoint(c, FixCoords(c, (IPoint) {x2, y1}), TAG_ONPATH); _AddIPoint(c, FixCoords(c, (IPoint) {x2, y2}), TAG_ONPATH); _AddIPoint(c, FixCoords(c, (IPoint) {x1, y2}), TAG_ONPATH); _SDL_SVG_RenderPath(closure); return SVG_STATUS_SUCCESS;} |
|
dst.e = in->c * in->f - in->d * in->e; dst.f = in->b * in->e - in->a * in->f; | dst.e = (in->c * in->f - in->d * in->e)/det; dst.f = (in->b * in->e - in->a * in->f)/det; | svg_matrix_t svg_matrix_invert(svg_matrix_t *in){float det;svg_matrix_t dst; det = in->a * in->d - in->b * in->c; if(det == 0.0) return (svg_matrix_t) {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}; dst.a = in->d/det; dst.b = -in->b/det; dst.c = -in->c/det; dst.d = in->a/det; dst.e = in->c * in->f - in->d * in->e; dst.f = in->b * in->e - in->a * in->f; return dst;} |
the_object = _Objects_Get( information, id, OBJECTS_SEARCH_LOCAL_NODE ); | the_object = _Objects_Get( information, id, &ignored_location ); | Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( Objects_Id id, Objects_Name *name){ unsigned32 the_api; unsigned32 the_class; Objects_Information *information; Objects_Control *the_object = (Objects_Control *) 0; if ( !name ) return OBJECTS_INVALID_NAME; the_api = _Objects_Get_API( id ); if ( the_api && the_api > OBJECTS_APIS_LAST ) return OBJECTS_INVALID_ID; the_class = _Objects_Get_class( id ); information = _Objects_Information_table[ the_api ][ the_class ]; if ( !information ) return OBJECTS_INVALID_ID; if ( information->is_string ) return OBJECTS_INVALID_ID; the_object = _Objects_Get( information, id, OBJECTS_SEARCH_LOCAL_NODE ); if (!the_object) return OBJECTS_INVALID_ID; *name = the_object->name; return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;} |
if (precision(p1)) return 1; | if (precision(p1)) res = 1; | use_maximal_pivot(GEN x){ long tx,i,j, lx = lg(x), ly = lg(x[1]); GEN p1; for (i=1; i<lx; i++) for (j=1; j<ly; j++) { p1 = gmael(x,i,j); tx = typ(p1); if (!is_scalar_t(tx)) return 0; if (precision(p1)) return 1; } return 0;} |
return 0; | return res; | use_maximal_pivot(GEN x){ long tx,i,j, lx = lg(x), ly = lg(x[1]); GEN p1; for (i=1; i<lx; i++) for (j=1; j<ly; j++) { p1 = gmael(x,i,j); tx = typ(p1); if (!is_scalar_t(tx)) return 0; if (precision(p1)) return 1; } return 0;} |
tmppool); | request->respool); | static apr_status_t read_from_connection(serf_connection_t *conn){ apr_status_t status; apr_pool_t *tmppool; /* Whatever is coming in on the socket corresponds to the first request * on our chain. */ serf_request_t *request = conn->requests; /* assert: request != NULL */ if ((status = apr_pool_create(&tmppool, request->respool)) != APR_SUCCESS) goto error; /* Invoke response handlers until we have no more work. */ while (1) { apr_pool_clear(tmppool); /* If the request doesn't have a response bucket, then call the * acceptor to get one created. */ if (request->resp_bkt == NULL) { request->resp_bkt = (*request->acceptor)(request, conn->skt, request->acceptor_baton, tmppool); apr_pool_clear(tmppool); } status = (*request->handler)(request->resp_bkt, request->handler_baton, tmppool); if (!APR_STATUS_IS_EOF(status)) { /* Whether success, or an error, there is no more to do unless * this request has been completed. */ goto error; } /* The request has been fully-delivered, and the response has * been fully-read. Remove it from our queue and loop to read * another response. */ conn->requests = request->next; /* The bucket is no longer needed, nor is the request's pool. */ serf_bucket_destroy(request->resp_bkt); apr_pool_destroy(request->respool); request = conn->requests; /* If we just ran out of requests, then update the pollset. We * don't want to read from this socket any more. We are definitely * done with this loop, too. */ if (request == NULL) { status = update_pollset(conn); goto error; } } error: apr_pool_destroy(tmppool); return status;} |
unsigned32 erc32_sonic_read_register( | uint32_t erc32_sonic_read_register( | unsigned32 erc32_sonic_read_register( void *base, unsigned32 regno){ volatile unsigned32 *p = base; unsigned32 value; value = p[regno];#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) printf( "%p Read 0x%04x from %s (0x%02x)\n", &p[regno], value, SONIC_Reg_name[regno], regno ); fflush( stdout );#endif return 0x0ffff & value;} |
unsigned32 regno | uint32_t regno | unsigned32 erc32_sonic_read_register( void *base, unsigned32 regno){ volatile unsigned32 *p = base; unsigned32 value; value = p[regno];#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) printf( "%p Read 0x%04x from %s (0x%02x)\n", &p[regno], value, SONIC_Reg_name[regno], regno ); fflush( stdout );#endif return 0x0ffff & value;} |
volatile unsigned32 *p = base; unsigned32 value; | volatile uint32_t *p = base; uint32_t value; | unsigned32 erc32_sonic_read_register( void *base, unsigned32 regno){ volatile unsigned32 *p = base; unsigned32 value; value = p[regno];#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) printf( "%p Read 0x%04x from %s (0x%02x)\n", &p[regno], value, SONIC_Reg_name[regno], regno ); fflush( stdout );#endif return 0x0ffff & value;} |
rtems_unsigned32 task_count = 0; | uint32_t task_count = 0; | void test1(){ boolean auto_extend; rtems_status_code result; rtems_unsigned32 task_count = 0; Objects_Information *the_information; char c1 = 'a'; char c2 = 'a'; char c3 = '0'; char c4 = '0'; printf( "\n TEST1 : auto-extend disabled.\n" ); /* * This is a major hack and only recommended for a test. Doing this * saves having another test. */ the_information = _Objects_Information_table[OBJECTS_CLASSIC_API][OBJECTS_RTEMS_TASKS]; auto_extend = the_information->auto_extend; the_information->auto_extend = FALSE; while (task_count < MAX_TASKS) { rtems_name name; printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4); name = rtems_build_name(c1, c2, c3, c4); result = rtems_task_create(name, 10, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES, RTEMS_LOCAL, &task_id[task_count]); if (status_code_bad(result)) break; printf("number = %3i, id = %08x, starting, ", task_count, task_id[task_count]); fflush(stdout); result = rtems_task_start(task_id[task_count], test_task, (rtems_task_argument) task_count); if (status_code_bad(result)) break; /* * Update the name. */ NEXT_TASK_NAME(c1, c2, c3, c4); task_count++; } if (task_count >= MAX_TASKS) printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" ); if (task_count != (TASK_ALLOCATION_SIZE - 1)) { printf( " FAIL1 : the number of tasks does not equal the expected size -\n" " task created = %i, required number = %i\n", task_count, TASK_ALLOCATION_SIZE); exit( 1 ); } destory_all_tasks("TEST1"); the_information->auto_extend = auto_extend; printf( " TEST1 : completed\n" );} |
puts(""); | void stat_a_file( const char *file){ int status; struct stat statbuf; assert( file ); printf( "stat( %s ) returned ", file ); fflush( stdout ); status = stat( file, &statbuf ); if ( status == -1 ) { printf( ": %s\n", strerror( errno ) ); } else { dump_statbuf( &statbuf ); }} |
|
long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; | long ell, i, j, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, vnf; long l, lSp, lSml2, lSl2, lW; | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; | GEN polnf,bnf,nf,bnfz,nfz,bid,ideal,cycgen,gell,p1,p2,wk,U,vselmer; GEN clgp,fununits,torsunit,Tc,Tv,P; GEN Q,idealz,gothf,factgothf; GEN M,K,y,vecMsup,vecW,vecWA,vecWB,vecB,vecC; GEN u,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp,listprSp; | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; | compositum_red(&COMPO, polnf, cyclo(ell,vnf)); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; | degKz = degpol(COMPO.R); m = degKz / degK; d = (ell-1) / m; | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
|
bnfz = bnfinit0(R,1,NULL,prec); | bnfz = bnfinit0(COMPO.R,1,NULL,prec); cycgen = check_and_build_cycgen(bnfz); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
tau = get_tau(&_tau, nfz, U); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
|
cycgen = check_and_build_cycgen(bnfz); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
|
uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); | u = cgetg(l,t_VEC); for (j=1; j<=rc; j++) u[j] = zero; for ( ; j< l; j++) u[j] = lmpinvmod((GEN)cyc[j], gell); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
U = gadd(gpowgs(COMPO.q, g), gmul(COMPO.k, COMPO.p)); U = poleval(COMPO.rev, U); tau = get_tau(&_tau, nfz, U); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
|
p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); | p1 = tauofideal(nfz, (GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,u,gell,rc); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; | p2 = vecB; | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
p3 = tauofvec(p3, tau); | p2 = tauofvec(p2, tau); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; | vecC[i] = (long)famat_mul((GEN)vecC[i], famat_factorback(p2, (GEN)T[i])); } | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
dc = lg(Q)-1; if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); | if (DEBUGLEVEL>2) fprintferr("Step 8\n"); p1 = RXQ_powers(lift_intern(COMPO.p), COMPO.R, degK-1); p1 = vecpol_to_mat(p1, degKz); T.invexpoteta1 = invmat(p1); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); | GEN e, a, ap; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,u,gell,rc); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); | p2 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p2; ap = cgetg(1, t_MAT); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); | ap = famat_mul(ap, famat_pow(p2, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p2 = tauofelt(p2, tau); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
vecalphap[j] = (long)p2; } | vecalphap[j] = (long)ap; } | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
dK= lg(K)-1; if (!dK) { avma=av; return gzero; } | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
|
y = cgetg(dK,t_VECSMALL); do | dK = lg(K)-1; y = cgetg(dK+1,t_VECSMALL); while (dK) | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); i = dK; do | y[i] = 1; do { GEN be, res, X = FpV_red(gmul_mati_smallvec(K, y), gell); if (ok_congruence(X,gell,lW,vecMsup)) | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); } DECREASE: | be = compute_beta(X, vecWB, gell, bnfz); res = compute_polrel(&T, be, g, ell); if (DEBUGLEVEL>1) fprintferr("polrel(beta) = %Z\n", res); if (gegal(subgroup, rnfnormgroup(bnr, res))) return gerepilecopy(av, res); } } while (increment_y(y, dK, ell)); | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
while (dK); avma = av; return gzero; | avma = av; return gzero; | rnfkummer(GEN bnr, GEN subgroup, long all, long prec){ long i, j, l, m, d, dK, dc, rc, ru, rv, g, mginv, degK, degKz, ell; long lSp, lSl2, lSml2, lW, vnf; gpmem_t av = avma; GEN p1,p2,p3,wk,U,R,gell; GEN polnf,nf,bnf,bnfz,bid,ideal,cycgen,vselmer; GEN kk,clgp,fununits,torsunit,vecB,vecC,Tc,Tv,P; GEN Q,idealz,gothf,factgothf,nfz; GEN listprSp,vecW,vecWA,vecWB; GEN M,K,y,A1,A2,A3,A3rev,vecMsup; GEN uu,gen,cyc,vecalpha,vecalphap,vecbetap,matP,Sp; primlist L; toK_s T; tau_s _tau, *tau; checkbnrgen(bnr); bnf = (GEN)bnr[1]; nf = (GEN)bnf[7]; polnf = (GEN)nf[1]; vnf = varn(polnf); if (!vnf) err(talker,"main variable in kummer must not be x"); wk = gmael3(bnf,8,4,1); /* step 7 */ if (all) subgroup = NULL; p1 = conductor(bnr, subgroup, 2); bnr = (GEN)p1[2]; subgroup = (GEN)p1[3]; gell = get_gell(bnr,subgroup,all); if (gcmp1(gell)) { avma = av; return polx[vnf]; } if (!isprime(gell)) err(impl,"kummer for composite relative degree"); if (divise(wk,gell)) return gerepilecopy(av, rnfkummersimple(bnr,subgroup,all)); if (all) err(impl,"extensions by degree in kummer when zeta not in K"); bid = (GEN)bnr[2]; ideal = gmael(bid,1,1); ell = itos(gell); /* step 1 of alg 5.3.5. */ if (DEBUGLEVEL>2) fprintferr("Step 1\n"); p1 = (GEN)compositum2(polnf, cyclo(ell,vnf))[1]; R = (GEN)p1[1]; A1= (GEN)p1[2]; A2= (GEN)p1[3]; kk= (GEN)p1[4]; /* step 2 */ if (DEBUGLEVEL>2) fprintferr("Step 2\n"); degK = degpol(polnf); degKz = degpol(R); m = degKz/degK; d = (ell-1)/m; g = powuumod(u_gener(ell), d, ell); if (powuumod(g, m, ell*ell) == 1) g += ell; /* ord(g)=m in all (Z/ell^k)^* */ /* step reduction of R */ if (DEBUGLEVEL>2) fprintferr("Step reduction\n"); p1 = polredabs0(R, nf_ORIG|nf_PARTIALFACT); R = (GEN)p1[1]; if (DEBUGLEVEL>2) fprintferr("polredabs = %Z",R); A3= (GEN)p1[2]; A1 = poleval(lift(A1), A3); A2 = poleval(lift(A2), A3); A3rev= modreverse_i((GEN)A3[2], (GEN)A3[1]); U = gadd(gpowgs(A2,g), gmul(kk,A1)); U = poleval(A3rev, U); /* step 3 */ /* one could factor disc(R) using th. 2.1.6. */ if (DEBUGLEVEL>2) fprintferr("Step 3\n"); bnfz = bnfinit0(R,1,NULL,prec); nfz = (GEN)bnfz[7]; tau = get_tau(&_tau, nfz, U); clgp = gmael(bnfz,8,1); cyc = (GEN)clgp[2]; rc = prank(cyc,ell); gen = (GEN)clgp[3]; l = lg(cyc); vecalpha = cgetg(l,t_VEC); cycgen = check_and_build_cycgen(bnfz); for (j=1; j<l; j++) vecalpha[j] = (long)basistoalg(nfz, famat_to_nf(nfz, (GEN)cycgen[j])); /* computation of the uu(j) (see remark 5.2.15.) */ uu = cgetg(l,t_VEC); for (j=1; j<=rc; j++) uu[j] = zero; for ( ; j< l; j++) uu[j] = lmpinvmod((GEN)cyc[j], gell); fununits = check_units(bnfz,"rnfkummer"); torsunit = gmael3(bnfz,8,4,2); ru = (degKz>>1)-1; rv = rc+ru+1; vselmer = cgetg(rv+1,t_VEC); for (j=1; j<=rc; j++) vselmer[j] = cycgen[j]; for ( ; j< rv; j++) vselmer[j] = fununits[j-rc]; vselmer[rv]=(long)torsunit; /* step 4 */ if (DEBUGLEVEL>2) fprintferr("Step 4\n"); vecB=cgetg(rc+1,t_VEC); Tc=cgetg(rc+1,t_MAT); for (j=1; j<=rc; j++) { p1 = tauofideal(nfz,(GEN)gen[j], tau); p1 = isprincipalell(bnfz, p1, cycgen,uu,gell,rc); Tc[j] = p1[1]; vecB[j]= p1[2]; } p1 = cgetg(m,t_VEC); p1[1] = (long)idmat(rc); for (j=2; j<=m-1; j++) p1[j] = lmul((GEN)p1[j-1],Tc); p2 = cgetg(rc+1,t_VEC); for (j=1; j<=rc; j++) p2[j] = lgetg(1, t_MAT); p3 = vecB; for (j=1; j<=m-1; j++) { GEN T = FpM_red(gmulsg((j*d)%ell,(GEN)p1[m-j]), gell); p3 = tauofvec(p3, tau); for (i=1; i<=rc; i++) p2[i] = (long)famat_mul((GEN)p2[i], famat_factorback(p3, (GEN)T[i])); } vecC = p2; for (i=1; i<=rc; i++) vecC[i] = (long)famat_reduce((GEN)vecC[i]); /* step 5 */ if (DEBUGLEVEL>2) fprintferr("Step 5\n"); Tv = cgetg(rv+1,t_MAT); for (j=1; j<=rv; j++) { p1 = tauofelt((GEN)vselmer[j], tau); if (typ(p1) == t_MAT) p1 = factorbackelt(p1, nfz, NULL); /* famat */ Tv[j] = isvirtualunit(bnfz, p1, vecalpha,cyc,gell,rc)[1]; } P = FpM_ker(gsubgs(Tv, g), gell); lW = lg(P); vecW = cgetg(lW,t_VEC); for (j=1; j<lW; j++) vecW[j] = (long)famat_factorback(vselmer, (GEN)P[j]); /* step 6 */ if (DEBUGLEVEL>2) fprintferr("Step 6\n"); Q = FpM_ker(gsubgs(gtrans(Tc), g), gell); dc = lg(Q)-1; /* step 7 done above */ /* step 8 */ if (DEBUGLEVEL>2) fprintferr("Step 7 and 8\n"); idealz = lifttoKz(nfz, nf, ideal, A1); A1 = lift_intern(A1); p1 = polun[vnf]; p2 = cgetg(degK+1,t_MAT); for (j=1; j<=degK; j++) { p2[j] = (long)pol_to_vec(p1, degKz); if (j<degK) p1 = gmod(gmul(p1,A1), R); } T.invexpoteta1 = invmat(p2); /* left inverse */ T.polnf = polnf; T.tau = tau; T.m = m; if (smodis(idealnorm(nf,ideal), ell)) gothf = idealz; else { /* l | N(ideal) */ GEN bnrz = buchrayinitgen(bnfz, idealz); GEN subgroupz = invimsubgroup(&T, bnrz,bnr,subgroup); gothf = conductor(bnrz,subgroupz,0); } /* step 9 */ if (DEBUGLEVEL>2) fprintferr("Step 9\n"); factgothf = idealfactor(nfz,gothf); /* step 10 and step 11 */ if (DEBUGLEVEL>2) fprintferr("Step 10 and 11\n"); i = build_list_Hecke(&L, nfz, factgothf, gothf, gell, tau); if (i) return no_sol(all,i); lSml2 = lg(L.Sml2)-1; Sp = concatsp(L.Sm, L.Sml1); lSp = lg(Sp)-1; listprSp = concatsp(L.Sml2, L.Sl); lSl2 = lg(listprSp)-1; /* step 12 */ if (DEBUGLEVEL>2) fprintferr("Step 12\n"); vecbetap = cgetg(lSp+1,t_VEC); vecalphap= cgetg(lSp+1,t_VEC); matP = cgetg(lSp+1,t_MAT); for (j=1; j<=lSp; j++) { GEN e, a; p1 = isprincipalell(bnfz, (GEN)Sp[j], cycgen,uu,gell,rc); e = (GEN)p1[1]; a = (GEN)p1[2]; matP[j] = (long)e; p3 = famat_mul(famat_factorback(vecC, gneg(e)), a); vecbetap[j] = (long)p3; p2 = cgetg(1, t_MAT); for (i=0; i<m; i++) { p2 = famat_mul(p2, famat_pow(p3, utoi(powuumod(g,m-1-i,ell)))); if (i < m-1) p3 = tauofelt(p3, tau); } vecalphap[j] = (long)p2; } /* step 13 */ if (DEBUGLEVEL>2) fprintferr("Step 13\n"); vecWB = concatsp(vecW, vecbetap); vecWA = concatsp(vecW, vecalphap); /* step 14, 15, and 17 */ if (DEBUGLEVEL>2) fprintferr("Step 14, 15 and 17\n"); mginv = (m * u_invmod(g,ell)) % ell; vecMsup = cgetg(lSml2+1,t_VEC); M = NULL; for (i=1; i<=lSl2; i++) { GEN pr = (GEN)listprSp[i]; long e = itos((GEN)pr[3]), z = ell * (e / (ell-1)); if (i <= lSml2) { z += 1 - L.ESml2[i]; vecMsup[i] = (long)logall(nfz, vecWA,lW,mginv,ell,pr, z+1); } M = vconcat(M, logall(nfz, vecWA,lW,mginv,ell,pr, z)); } if (dc) { GEN QtP = gmul(gtrans_i(Q),matP); M = vconcat(M, concatsp(zeromat(dc,lW-1), QtP)); } if (!M) M = zeromat(1, lSp + lW - 1); /* step 16 */ if (DEBUGLEVEL>2) fprintferr("Step 16\n"); K = FpM_ker(M, gell); dK= lg(K)-1; if (!dK) { avma=av; return gzero; } /* step 18 */ if (DEBUGLEVEL>2) fprintferr("Step 18\n"); y = cgetg(dK,t_VECSMALL); do { for (i=1; i<dK; i++) y[i] = 0; /* step 19 */ for(;;) { GEN res, X = (GEN)K[dK]; for (j=1; j<dK; j++) X = gadd(X, gmulsg(y[j],(GEN)K[j])); res = testx(&T,bnfz,bnr,X,subgroup,vecMsup,vecWB,g,gell,lW); if (res) return gerepilecopy(av, res); /* step 20,21,22 */ i = dK; do { i--; if (!i) goto DECREASE; if (i < dK-1) y[i+1] = 0; y[i]++; } while (y[i] >= ell); }DECREASE: dK--; } while (dK); avma = av; return gzero;} |
int i; | subtask (rtems_task_argument arg){ int i; rtems_status_code sc; rtems_id sem = (rtems_id)arg; for (;;) { rtems_task_wake_after (ticksPerSecond * 2); sc = rtems_semaphore_release (sem); if (sc != RTEMS_SUCCESSFUL) printf ("%d: Can't release semaphore: %s\n", __LINE__, rtems_status_text (sc)); }} |
|
reducebeta(GEN bnfz, GEN be, long ell) | reducebeta(GEN bnfz, GEN be, GEN ell) | reducebeta(GEN bnfz, GEN be, long ell){ long j,ru, prec = nfgetprec(bnfz); GEN emb,z,u,matunit, nf = checknf(bnfz); matunit = gmulgs(greal((GEN)bnfz[3]), ell); /* log. embeddings of fu^ell */ for (;;) { z = get_arch_real(nf, be, &emb, prec); if (z) break; prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"reducebeta",prec); nf = nfnewprec(nf,prec); } z = concatsp(matunit, z); u = lllintern(z, 100, 1, prec); if (u) { ru = lg(u); for (j=1; j < ru; j++) if (smodis(gcoeff(u,ru-1,j), ell)) break; /* prime to ell */ if (j < ru) { u = (GEN)u[j]; /* coords on (fu^ell, be) of a small generator */ ru--; setlg(u, ru); be = element_pow(nf, be, (GEN)u[ru]); be = fix_be(bnfz,be,u); } } return reducebetanaive(bnfz, be, NULL, ell);} |
matunit = gmulgs(greal((GEN)bnfz[3]), ell); | if (DEBUGLEVEL>1) fprintferr("reducing beta = %Z\n",be); be = reduce_mod_Qell(nf, be, ell); z = idealsqrtn(nf, be, ell, 0); z = ideallllred_elt(nf, z); be = element_div(nf, be, element_pow(nf, z, ell)); be = reduce_mod_Qell(nf, be, ell); if (DEBUGLEVEL>1) fprintferr("beta reduced via ell-th root = %Z\n",be); matunit = gmul(greal((GEN)bnfz[3]), ell); | reducebeta(GEN bnfz, GEN be, long ell){ long j,ru, prec = nfgetprec(bnfz); GEN emb,z,u,matunit, nf = checknf(bnfz); matunit = gmulgs(greal((GEN)bnfz[3]), ell); /* log. embeddings of fu^ell */ for (;;) { z = get_arch_real(nf, be, &emb, prec); if (z) break; prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"reducebeta",prec); nf = nfnewprec(nf,prec); } z = concatsp(matunit, z); u = lllintern(z, 100, 1, prec); if (u) { ru = lg(u); for (j=1; j < ru; j++) if (smodis(gcoeff(u,ru-1,j), ell)) break; /* prime to ell */ if (j < ru) { u = (GEN)u[j]; /* coords on (fu^ell, be) of a small generator */ ru--; setlg(u, ru); be = element_pow(nf, be, (GEN)u[ru]); be = fix_be(bnfz,be,u); } } return reducebetanaive(bnfz, be, NULL, ell);} |
if (smodis(gcoeff(u,ru-1,j), ell)) break; | if (!divise(gcoeff(u,ru-1,j), ell)) break; | reducebeta(GEN bnfz, GEN be, long ell){ long j,ru, prec = nfgetprec(bnfz); GEN emb,z,u,matunit, nf = checknf(bnfz); matunit = gmulgs(greal((GEN)bnfz[3]), ell); /* log. embeddings of fu^ell */ for (;;) { z = get_arch_real(nf, be, &emb, prec); if (z) break; prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"reducebeta",prec); nf = nfnewprec(nf,prec); } z = concatsp(matunit, z); u = lllintern(z, 100, 1, prec); if (u) { ru = lg(u); for (j=1; j < ru; j++) if (smodis(gcoeff(u,ru-1,j), ell)) break; /* prime to ell */ if (j < ru) { u = (GEN)u[j]; /* coords on (fu^ell, be) of a small generator */ ru--; setlg(u, ru); be = element_pow(nf, be, (GEN)u[ru]); be = fix_be(bnfz,be,u); } } return reducebetanaive(bnfz, be, NULL, ell);} |
be = fix_be(bnfz,be,u); | be = fix_be(bnfz, be, gmul(ell,u)); | reducebeta(GEN bnfz, GEN be, long ell){ long j,ru, prec = nfgetprec(bnfz); GEN emb,z,u,matunit, nf = checknf(bnfz); matunit = gmulgs(greal((GEN)bnfz[3]), ell); /* log. embeddings of fu^ell */ for (;;) { z = get_arch_real(nf, be, &emb, prec); if (z) break; prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"reducebeta",prec); nf = nfnewprec(nf,prec); } z = concatsp(matunit, z); u = lllintern(z, 100, 1, prec); if (u) { ru = lg(u); for (j=1; j < ru; j++) if (smodis(gcoeff(u,ru-1,j), ell)) break; /* prime to ell */ if (j < ru) { u = (GEN)u[j]; /* coords on (fu^ell, be) of a small generator */ ru--; setlg(u, ru); be = element_pow(nf, be, (GEN)u[ru]); be = fix_be(bnfz,be,u); } } return reducebetanaive(bnfz, be, NULL, ell);} |
if (DEBUGLEVEL>1) fprintferr("beta LLL-reduced mod units = %Z\n",be); | reducebeta(GEN bnfz, GEN be, long ell){ long j,ru, prec = nfgetprec(bnfz); GEN emb,z,u,matunit, nf = checknf(bnfz); matunit = gmulgs(greal((GEN)bnfz[3]), ell); /* log. embeddings of fu^ell */ for (;;) { z = get_arch_real(nf, be, &emb, prec); if (z) break; prec = (prec-1)<<1; if (DEBUGLEVEL) err(warnprec,"reducebeta",prec); nf = nfnewprec(nf,prec); } z = concatsp(matunit, z); u = lllintern(z, 100, 1, prec); if (u) { ru = lg(u); for (j=1; j < ru; j++) if (smodis(gcoeff(u,ru-1,j), ell)) break; /* prime to ell */ if (j < ru) { u = (GEN)u[j]; /* coords on (fu^ell, be) of a small generator */ ru--; setlg(u, ru); be = element_pow(nf, be, (GEN)u[ru]); be = fix_be(bnfz,be,u); } } return reducebetanaive(bnfz, be, NULL, ell);} |
|
return 0; | Thread _Thread_Idle_body( unsigned32 ignored ){ for( ; ; ) { asm volatile( "mfmsr 3; oris 3,3,4; sync; mtmsr 3; isync; ori 3,3,0; ori 3,3,0" ); }} |
|
F->subFB = yes; F->pow = NULL; return 1; | gunclone(F->subFB); F->subFB = gclone(yes); F->pow = NULL; avma = av; return 1; | subFB_increase(FB_t *F, GEN nf, long step){ GEN yes, D = (GEN)nf[3]; long i, iyes, lv = F->KC + 1, minsFB = lg(F->subFB)-1 + step; yes = cgetg(minsFB+1, t_VECSMALL); iyes = 1; for (i = 1; i < lv; i++) { long t = F->perm[i]; if (!ok_subFB(F, t, D)) continue; yes[iyes++] = t; if (iyes > minsFB) break; } if (i == lv) return 0; F->subFB = yes; F->pow = NULL; return 1;} |
F->pow = NULL; avma = av; return 1; | F->newpow = 1; avma = av; return 1; | subFB_change(FB_t *F, GEN nf, GEN L_jid){ GEN yes, D = (GEN)nf[3]; long i, iyes, minsFB, chg = F->sfb_chg, lv = F->KC + 1, l = lg(F->subFB)-1; pari_sp av = avma; switch (chg) { case sfb_INCREASE: minsFB = l + 1; break; default: minsFB = l; break; } if (DEBUGLEVEL) fprintferr("*** Changing sub factor base\n"); yes = cgetg(minsFB+1, t_VECSMALL); iyes = 1; if (L_jid) { for (i = 1; i < lg(L_jid); i++) { long t = L_jid[i]; if (!ok_subFB(F, t, D)) continue; yes[iyes++] = t; if (iyes > minsFB) break; } } else i = 1; if (iyes <= minsFB) { for ( ; i < lv; i++) { long t = F->perm[i]; if (!ok_subFB(F, t, D)) continue; yes[iyes++] = t; if (iyes > minsFB) break; } if (i == lv) return 0; } if (gegal(F->subFB, yes)) { if (chg != sfb_UNSUITABLE) F->sfb_chg = 0; } else { gunclone(F->subFB); F->subFB = gclone(yes); F->sfb_chg = 0; } F->pow = NULL; avma = av; return 1;} |
pari_sp ltop, lim; long i,k,lx = lg(x); if (lx == 1) return gen_1; if (lx == 2) return gcopy(gel(x,1)); x = shallowcopy(x); k = lx; ltop=avma; lim = stack_lim(ltop,1); while (k > 2) { if (DEBUGLEVEL>7) fprintferr("prod: remaining objects %ld\n",k-1); lx = k; k = 1; for (i=1; i<lx-1; i+=2) gel(x,k++) = mul(gel(x,i),gel(x,i+1)); if (i < lx) x[k++] = x[i]; if (low_stack(lim,stack_lim(av,1))) gerepilecoeffs(ltop,x+1,k-1); } return gel(x,1); | return divide_conquer_assoc(x, _domul, (void *)mul); | divide_conquer_prod(GEN x, GEN (*mul)(GEN,GEN)){ pari_sp ltop, lim; long i,k,lx = lg(x); if (lx == 1) return gen_1; if (lx == 2) return gcopy(gel(x,1)); x = shallowcopy(x); k = lx; ltop=avma; lim = stack_lim(ltop,1); while (k > 2) { if (DEBUGLEVEL>7) fprintferr("prod: remaining objects %ld\n",k-1); lx = k; k = 1; for (i=1; i<lx-1; i+=2) gel(x,k++) = mul(gel(x,i),gel(x,i+1)); if (i < lx) x[k++] = x[i]; if (low_stack(lim,stack_lim(av,1))) gerepilecoeffs(ltop,x+1,k-1); } return gel(x,1);} |
if (k > 0) xp = gmul(xp, gpuigs(p1, k)); else xm = gmul(xm, gpuigs(p1,-k)); | if (k > 0) xp = gmul(xp, gpowgs(p1, k)); else xm = gmul(xm, gpowgs(p1,-k)); | bnfissunit(GEN bnf,GEN suni,GEN x){ long lB, cH, i, k, ls; gpmem_t tetpil, av = avma; GEN den,gen,S,v,p1,xp,xm,xb,N,HB,perm; bnf = checkbnf(bnf); if (typ(suni)!=t_VEC || lg(suni)!=7) err(typeer,"bnfissunit"); switch (typ(x)) { case t_INT: case t_FRAC: case t_FRACN: case t_POL: case t_COL: x = basistoalg(bnf,x); break; case t_POLMOD: break; default: err(typeer,"bnfissunit"); } if (gcmp0(x)) return cgetg(1,t_COL); S = (GEN) suni[6]; ls=lg(S); if (ls==1) return isunit(bnf,x); p1 = (GEN)suni[2]; perm = (GEN)p1[1]; HB = (GEN)p1[2]; den = (GEN)p1[3]; cH = lg(HB[1]) - 1; lB = lg(HB) - cH; xb = algtobasis(bnf,x); p1 = Q_denom(xb); N = mulii(gnorm(gmul(x,p1)), p1); /* relevant primes divide N */ v = cgetg(ls, t_VECSMALL); for (i=1; i<ls; i++) { GEN P = (GEN)S[i]; v[i] = (resii(N, (GEN)P[1]) == gzero)? element_val(bnf,xb,P): 0; } /* here, x = S v */ p1 = cgetg(ls, t_COL); for (i=1; i<ls; i++) p1[i] = lstoi(v[perm[i]]); /* p1 = v o perm */ v = gmul(HB, p1); for (i=1; i<=cH; i++) { GEN w = gdiv((GEN)v[i], den); if (typ(w) != t_INT) { avma = av; return cgetg(1,t_COL); } v[i] = (long)w; } p1 += cH; p1[0] = evaltyp(t_COL) | evallg(lB); v = concatsp(v, p1); /* append bottom of p1 (= [0 Id] part) */ xp = gun; xm = gun; gen = (GEN)suni[1]; for (i=1; i<ls; i++) { k = -itos((GEN)v[i]); if (!k) continue; p1 = basistoalg(bnf, (GEN)gen[i]); if (k > 0) xp = gmul(xp, gpuigs(p1, k)); else xm = gmul(xm, gpuigs(p1,-k)); } if (xp != gun) x = gmul(x,xp); if (xm != gun) x = gdiv(x,xm); p1 = isunit(bnf,x); if (lg(p1)==1) { avma = av; return cgetg(1,t_COL); } tetpil=avma; return gerepile(av,tetpil,concat(p1,v));} |
} else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) | } else if ((rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh))) | route_output(m, so) register struct mbuf *m; struct socket *so;{ register struct rt_msghdr *rtm = 0; register struct rtentry *rt = 0; struct rtentry *saved_nrt = 0; struct radix_node_head *rnh; struct rt_addrinfo info; int len, error = 0; struct ifnet *ifp = 0; struct ifaddr *ifa = 0;#define senderr(e) { error = e; goto flush;} if (m == 0 || ((m->m_len < sizeof(long)) && (m = m_pullup(m, sizeof(long))) == 0)) return (ENOBUFS); if ((m->m_flags & M_PKTHDR) == 0) panic("route_output"); len = m->m_pkthdr.len; if (len < sizeof(*rtm) || len != mtod(m, struct rt_msghdr *)->rtm_msglen) { dst = 0; senderr(EINVAL); } R_Malloc(rtm, struct rt_msghdr *, len); if (rtm == 0) { dst = 0; senderr(ENOBUFS); } m_copydata(m, 0, len, (caddr_t)rtm); if (rtm->rtm_version != RTM_VERSION) { dst = 0; senderr(EPROTONOSUPPORT); } info.rti_addrs = rtm->rtm_addrs; if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) { dst = 0; senderr(EINVAL); } if (dst == 0 || (dst->sa_family >= AF_MAX) || (gate != 0 && (gate->sa_family >= AF_MAX))) senderr(EINVAL); if (genmask) { struct radix_node *t; t = rn_addmask((caddr_t)genmask, 0, 1); if (t && Bcmp(genmask, t->rn_key, *(u_char *)genmask) == 0) genmask = (struct sockaddr *)(t->rn_key); else senderr(ENOBUFS); } switch (rtm->rtm_type) { case RTM_ADD: if (gate == 0) senderr(EINVAL); error = rtrequest(RTM_ADD, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0 && saved_nrt) { rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &saved_nrt->rt_rmx); saved_nrt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); saved_nrt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); saved_nrt->rt_refcnt--; saved_nrt->rt_genmask = genmask; } break; case RTM_DELETE: error = rtrequest(RTM_DELETE, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0) { if ((rt = saved_nrt)) rt->rt_refcnt++; goto report; } break; case RTM_GET: case RTM_CHANGE: case RTM_LOCK: if ((rnh = rt_tables[dst->sa_family]) == 0) { senderr(EAFNOSUPPORT); } else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) rt->rt_refcnt++; else senderr(ESRCH); switch(rtm->rtm_type) { case RTM_GET: report: dst = rt_key(rt); gate = rt->rt_gateway; netmask = rt_mask(rt); genmask = rt->rt_genmask; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { ifpaddr = ifp->if_addrlist->ifa_addr; ifaaddr = rt->rt_ifa->ifa_addr; rtm->rtm_index = ifp->if_index; } else { ifpaddr = 0; ifaaddr = 0; } } len = rt_msg2(rtm->rtm_type, &info, (caddr_t)0, (struct walkarg *)0); if (len > rtm->rtm_msglen) { struct rt_msghdr *new_rtm; R_Malloc(new_rtm, struct rt_msghdr *, len); if (new_rtm == 0) senderr(ENOBUFS); Bcopy(rtm, new_rtm, rtm->rtm_msglen); Free(rtm); rtm = new_rtm; } (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, (struct walkarg *)0); rtm->rtm_flags = rt->rt_flags; rtm->rtm_rmx = rt->rt_rmx; rtm->rtm_addrs = info.rti_addrs; break; case RTM_CHANGE: if (gate && (error = rt_setgate(rt, rt_key(rt), gate))) senderr(error); /* * If they tried to change things but didn't specify * the required gateway, then just use the old one. * This can happen if the user tries to change the * flags on the default route without changing the * default gateway. Changing flags still doesn't work. */ if ((rt->rt_flags & RTF_GATEWAY) && !gate) gate = rt->rt_gateway; /* new gateway could require new ifaddr, ifp; flags may also be different; ifp may be specified by ll sockaddr when protocol address is ambiguous */ if (ifpaddr && (ifa = ifa_ifwithnet(ifpaddr)) && (ifp = ifa->ifa_ifp) && (ifaaddr || gate)) ifa = ifaof_ifpforaddr(ifaaddr ? ifaaddr : gate, ifp); else if ((ifaaddr && (ifa = ifa_ifwithaddr(ifaaddr))) || (gate && (ifa = ifa_ifwithroute(rt->rt_flags, rt_key(rt), gate)))) ifp = ifa->ifa_ifp; if (ifa) { register struct ifaddr *oifa = rt->rt_ifa; if (oifa != ifa) { if (oifa && oifa->ifa_rtrequest) oifa->ifa_rtrequest(RTM_DELETE, rt, gate); IFAFREE(rt->rt_ifa); rt->rt_ifa = ifa; ifa->ifa_refcnt++; rt->rt_ifp = ifp; } } rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &rt->rt_rmx); if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, gate); if (genmask) rt->rt_genmask = genmask; /* * Fall into */ case RTM_LOCK: rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); rt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); break; } break; default: senderr(EOPNOTSUPP); }flush: if (rtm) { if (error) rtm->rtm_errno = error; else rtm->rtm_flags |= RTF_DONE; } if (rt) rtfree(rt); { register struct rawcb *rp = 0; /* * Check to see if we don't want our own messages. */ if ((so->so_options & SO_USELOOPBACK) == 0) { if (route_cb.any_count <= 1) { if (rtm) Free(rtm); m_freem(m); return (error); } /* There is another listener, so construct message */ rp = sotorawcb(so); } if (rtm) { m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); Free(rtm); } if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ if (dst) route_proto.sp_protocol = dst->sa_family; raw_input(m, &route_proto, &route_src, &route_dst); if (rp) rp->rcb_proto.sp_family = PF_ROUTE; } return (error);} |
} else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) | } else if ((rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh))) | rt_msg1 __P((int, struct rt_addrinfo *));static int rt_msg2 __P((int, struct rt_addrinfo *, caddr_t, struct walkarg *));static int rt_xaddrs __P((caddr_t, caddr_t, struct rt_addrinfo *));static int sysctl_dumpentry __P((struct radix_node *rn, void *vw));static int sysctl_iflist __P((int af, struct walkarg *w));static int route_output __P((struct mbuf *, struct socket *));static int route_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *));static void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *));/* Sleazy use of local variables throughout file, warning!!!! */#define dst info.rti_info[RTAX_DST]#define gate info.rti_info[RTAX_GATEWAY]#define netmask info.rti_info[RTAX_NETMASK]#define genmask info.rti_info[RTAX_GENMASK]#define ifpaddr info.rti_info[RTAX_IFP]#define ifaaddr info.rti_info[RTAX_IFA]#define brdaddr info.rti_info[RTAX_BRD]/*ARGSUSED*/static introute_usrreq(so, req, m, nam, control) register struct socket *so; int req; struct mbuf *m, *nam, *control;{ register int error = 0; register struct rawcb *rp = sotorawcb(so); int s; if (req == PRU_ATTACH) { MALLOC(rp, struct rawcb *, sizeof(*rp), M_PCB, M_WAITOK); so->so_pcb = (caddr_t)rp; if (so->so_pcb) bzero(so->so_pcb, sizeof(*rp)); } if (req == PRU_DETACH && rp) { int af = rp->rcb_proto.sp_protocol; if (af == AF_INET) route_cb.ip_count--; else if (af == AF_IPX) route_cb.ipx_count--; else if (af == AF_NS) route_cb.ns_count--; else if (af == AF_ISO) route_cb.iso_count--; route_cb.any_count--; } s = splnet(); error = raw_usrreq(so, req, m, nam, control); rp = sotorawcb(so); if (req == PRU_ATTACH && rp) { int af = rp->rcb_proto.sp_protocol; if (error) { free((caddr_t)rp, M_PCB); splx(s); return (error); } if (af == AF_INET) route_cb.ip_count++; else if (af == AF_IPX) route_cb.ipx_count++; else if (af == AF_NS) route_cb.ns_count++; else if (af == AF_ISO) route_cb.iso_count++; rp->rcb_faddr = &route_src; route_cb.any_count++; soisconnected(so); so->so_options |= SO_USELOOPBACK; } splx(s); return (error);}/*ARGSUSED*/static introute_output(m, so) register struct mbuf *m; struct socket *so;{ register struct rt_msghdr *rtm = 0; register struct rtentry *rt = 0; struct rtentry *saved_nrt = 0; struct radix_node_head *rnh; struct rt_addrinfo info; int len, error = 0; struct ifnet *ifp = 0; struct ifaddr *ifa = 0;#define senderr(e) { error = e; goto flush;} if (m == 0 || ((m->m_len < sizeof(long)) && (m = m_pullup(m, sizeof(long))) == 0)) return (ENOBUFS); if ((m->m_flags & M_PKTHDR) == 0) panic("route_output"); len = m->m_pkthdr.len; if (len < sizeof(*rtm) || len != mtod(m, struct rt_msghdr *)->rtm_msglen) { dst = 0; senderr(EINVAL); } R_Malloc(rtm, struct rt_msghdr *, len); if (rtm == 0) { dst = 0; senderr(ENOBUFS); } m_copydata(m, 0, len, (caddr_t)rtm); if (rtm->rtm_version != RTM_VERSION) { dst = 0; senderr(EPROTONOSUPPORT); } info.rti_addrs = rtm->rtm_addrs; if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) { dst = 0; senderr(EINVAL); } if (dst == 0 || (dst->sa_family >= AF_MAX) || (gate != 0 && (gate->sa_family >= AF_MAX))) senderr(EINVAL); if (genmask) { struct radix_node *t; t = rn_addmask((caddr_t)genmask, 0, 1); if (t && Bcmp(genmask, t->rn_key, *(u_char *)genmask) == 0) genmask = (struct sockaddr *)(t->rn_key); else senderr(ENOBUFS); } switch (rtm->rtm_type) { case RTM_ADD: if (gate == 0) senderr(EINVAL); error = rtrequest(RTM_ADD, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0 && saved_nrt) { rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &saved_nrt->rt_rmx); saved_nrt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); saved_nrt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); saved_nrt->rt_refcnt--; saved_nrt->rt_genmask = genmask; } break; case RTM_DELETE: error = rtrequest(RTM_DELETE, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0) { if ((rt = saved_nrt)) rt->rt_refcnt++; goto report; } break; case RTM_GET: case RTM_CHANGE: case RTM_LOCK: if ((rnh = rt_tables[dst->sa_family]) == 0) { senderr(EAFNOSUPPORT); } else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) rt->rt_refcnt++; else senderr(ESRCH); switch(rtm->rtm_type) { case RTM_GET: report: dst = rt_key(rt); gate = rt->rt_gateway; netmask = rt_mask(rt); genmask = rt->rt_genmask; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { ifpaddr = ifp->if_addrlist->ifa_addr; ifaaddr = rt->rt_ifa->ifa_addr; rtm->rtm_index = ifp->if_index; } else { ifpaddr = 0; ifaaddr = 0; } } len = rt_msg2(rtm->rtm_type, &info, (caddr_t)0, (struct walkarg *)0); if (len > rtm->rtm_msglen) { struct rt_msghdr *new_rtm; R_Malloc(new_rtm, struct rt_msghdr *, len); if (new_rtm == 0) senderr(ENOBUFS); Bcopy(rtm, new_rtm, rtm->rtm_msglen); Free(rtm); rtm = new_rtm; } (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, (struct walkarg *)0); rtm->rtm_flags = rt->rt_flags; rtm->rtm_rmx = rt->rt_rmx; rtm->rtm_addrs = info.rti_addrs; break; case RTM_CHANGE: if (gate && (error = rt_setgate(rt, rt_key(rt), gate))) senderr(error); /* * If they tried to change things but didn't specify * the required gateway, then just use the old one. * This can happen if the user tries to change the * flags on the default route without changing the * default gateway. Changing flags still doesn't work. */ if ((rt->rt_flags & RTF_GATEWAY) && !gate) gate = rt->rt_gateway; /* new gateway could require new ifaddr, ifp; flags may also be different; ifp may be specified by ll sockaddr when protocol address is ambiguous */ if (ifpaddr && (ifa = ifa_ifwithnet(ifpaddr)) && (ifp = ifa->ifa_ifp) && (ifaaddr || gate)) ifa = ifaof_ifpforaddr(ifaaddr ? ifaaddr : gate, ifp); else if ((ifaaddr && (ifa = ifa_ifwithaddr(ifaaddr))) || (gate && (ifa = ifa_ifwithroute(rt->rt_flags, rt_key(rt), gate)))) ifp = ifa->ifa_ifp; if (ifa) { register struct ifaddr *oifa = rt->rt_ifa; if (oifa != ifa) { if (oifa && oifa->ifa_rtrequest) oifa->ifa_rtrequest(RTM_DELETE, rt, gate); IFAFREE(rt->rt_ifa); rt->rt_ifa = ifa; ifa->ifa_refcnt++; rt->rt_ifp = ifp; } } rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &rt->rt_rmx); if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, gate); if (genmask) rt->rt_genmask = genmask; /* * Fall into */ case RTM_LOCK: rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); rt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); break; } break; default: senderr(EOPNOTSUPP); }flush: if (rtm) { if (error) rtm->rtm_errno = error; else rtm->rtm_flags |= RTF_DONE; } if (rt) rtfree(rt); { register struct rawcb *rp = 0; /* * Check to see if we don't want our own messages. */ if ((so->so_options & SO_USELOOPBACK) == 0) { if (route_cb.any_count <= 1) { if (rtm) Free(rtm); m_freem(m); return (error); } /* There is another listener, so construct message */ rp = sotorawcb(so); } if (rtm) { m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); Free(rtm); } if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ if (dst) route_proto.sp_protocol = dst->sa_family; raw_input(m, &route_proto, &route_src, &route_dst); if (rp) rp->rcb_proto.sp_family = PF_ROUTE; } return (error);}static voidrt_setmetrics(which, in, out) u_long which; register struct rt_metrics *in, *out;{#define metric(f, e) if (which & (f)) out->e = in->e; metric(RTV_RPIPE, rmx_recvpipe); metric(RTV_SPIPE, rmx_sendpipe); metric(RTV_SSTHRESH, rmx_ssthresh); metric(RTV_RTT, rmx_rtt); metric(RTV_RTTVAR, rmx_rttvar); metric(RTV_HOPCOUNT, rmx_hopcount); metric(RTV_MTU, rmx_mtu); metric(RTV_EXPIRE, rmx_expire);#undef metric}#define ROUNDUP(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))/* * Extract the addresses of the passed sockaddrs. * Do a little sanity checking so as to avoid bad memory references. * This data is derived straight from userland. */static intrt_xaddrs(cp, cplim, rtinfo) register caddr_t cp, cplim; register struct rt_addrinfo *rtinfo;{ register struct sockaddr *sa; register int i; bzero(rtinfo->rti_info, sizeof(rtinfo->rti_info)); for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { if ((rtinfo->rti_addrs & (1 << i)) == 0) continue; sa = (struct sockaddr *)cp; /* * It won't fit. */ if ( (cp + sa->sa_len) > cplim ) { return (EINVAL); } /* * there are no more.. quit now * If there are more bits, they are in error. * I've seen this. route(1) can evidently generate these. * This causes kernel to core dump. * for compatibility, If we see this, point to a safe address. */ if (sa->sa_len == 0) { rtinfo->rti_info[i] = &sa_zero; return (0); /* should be EINVAL but for compat */ } /* accept it */ rtinfo->rti_info[i] = sa; ADVANCE(cp, sa); } return (0);}static struct mbuf *rt_msg1(type, rtinfo) int type; register struct rt_addrinfo *rtinfo;{ register struct rt_msghdr *rtm; register struct mbuf *m; register int i; register struct sockaddr *sa; int len, dlen; m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == 0) return (m); switch (type) { case RTM_DELADDR: case RTM_NEWADDR: len = sizeof(struct ifa_msghdr); break; case RTM_IFINFO: len = sizeof(struct if_msghdr); break; default: len = sizeof(struct rt_msghdr); } if (len > MHLEN) panic("rt_msg1"); m->m_pkthdr.len = m->m_len = len; m->m_pkthdr.rcvif = 0; rtm = mtod(m, struct rt_msghdr *); bzero((caddr_t)rtm, len); for (i = 0; i < RTAX_MAX; i++) { if ((sa = rtinfo->rti_info[i]) == NULL) continue; rtinfo->rti_addrs |= (1 << i); dlen = ROUNDUP(sa->sa_len); m_copyback(m, len, dlen, (caddr_t)sa); len += dlen; } if (m->m_pkthdr.len != len) { m_freem(m); return (NULL); } rtm->rtm_msglen = len; rtm->rtm_version = RTM_VERSION; rtm->rtm_type = type; return (m);} |
S = init_pow_q_mod_pT(X, q, u, T, p); | S = init_spec_FqXQ_pow(X, q, u, T, p); | FqX_sqf_split(GEN *t0, GEN q, GEN T, GEN p){ GEN *t = t0, u = *t, v, S, g, X; long d, dg, N = degpol(u); if (N == 1) return 1; v = X = polx[varn(u)]; S = init_pow_q_mod_pT(X, q, u, T, p); for (d=1; d <= N>>1; d++) { v = spec_FqXQ_pow(v, S, T, p); g = FqX_gcd(gsub(v,X),u, T,p); dg = degpol(g); if (dg <= 0) continue; /* all factors of g have degree d */ *t = g; FqX_split(t, d, q, S, T, p); t += dg / d; N -= dg; if (N) { u = FqX_div(u,g, T,p); v = FqX_rem(v,u, T,p); } } if (N) *t++ = u; return t - t0;} |
rtems_unsigned32 real_trap; | uint32_t real_trap; | rtems_isr bsp_spurious_handler( rtems_vector_number trap, CPU_Interrupt_frame *isf){ char line[ 80 ]; rtems_unsigned32 real_trap; real_trap = SPARC_REAL_TRAP_NUMBER(trap); strcpy(line, "Unexpected trap (0x ) at address 0x "); line[ 19 ] = digits[ real_trap >> 4 ]; line[ 20 ] = digits[ real_trap & 0xf ]; itos(isf->tpc, &line[36]); DEBUG_puts( line ); switch (real_trap) { /* * First the ones defined by the basic architecture */ case 0x00: DEBUG_puts( "reset" ); break; case 0x01: DEBUG_puts( "instruction access exception" ); break; case 0x02: DEBUG_puts( "illegal instruction" ); break; case 0x03: DEBUG_puts( "privileged instruction" ); break; case 0x04: DEBUG_puts( "fp disabled" ); break; case 0x07: DEBUG_puts( "memory address not aligned" ); break; case 0x08: DEBUG_puts( "fp exception" ); break; case 0x09: strcpy(line, "data access exception at 0x " ); itos(ERC32_MEC.First_Failing_Address, &line[27]); DEBUG_puts( line ); break; case 0x0A: DEBUG_puts( "tag overflow" ); break; /* * Then the ones defined by the ERC32 in particular */ case ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ): DEBUG_puts( "ERC32_INTERRUPT_MASKED_ERRORS" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_1 ): DEBUG_puts( "ERC32_INTERRUPT_EXTERNAL_1" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_2 ): DEBUG_puts( "ERC32_INTERRUPT_EXTERNAL_2" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_A_RX_TX ): DEBUG_puts( "ERC32_INTERRUPT_UART_A_RX_TX" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_B_RX_TX ): DEBUG_puts( "ERC32_INTERRUPT_UART_A_RX_TX" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR ): DEBUG_puts( "ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_UART_ERROR ): DEBUG_puts( "ERC32_INTERRUPT_UART_ERROR" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_DMA_ACCESS_ERROR ): DEBUG_puts( "ERC32_INTERRUPT_DMA_ACCESS_ERROR" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_DMA_TIMEOUT ): DEBUG_puts( "ERC32_INTERRUPT_DMA_TIMEOUT" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_3 ): DEBUG_puts( "ERC32_INTERRUPT_EXTERNAL_3" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_4 ): DEBUG_puts( "ERC32_INTERRUPT_EXTERNAL_4" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER ): DEBUG_puts( "ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK ): DEBUG_puts( "ERC32_INTERRUPT_REAL_TIME_CLOCK" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_EXTERNAL_5 ): DEBUG_puts( "ERC32_INTERRUPT_EXTERNAL_5" ); break; case ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ): DEBUG_puts( "ERC32_INTERRUPT_WATCHDOG_TIMEOUT" ); break; default: break; } /* * What else can we do but stop ... */ asm volatile( "mov 1, %g1; ta 0x0" );} |
rtems_unsigned32 trap; unsigned32 level = 15; unsigned32 mask; | uint32_t trap; uint32_t level = 15; uint32_t mask; | void bsp_spurious_initialize(){ rtems_unsigned32 trap; unsigned32 level = 15; unsigned32 mask; sparc_disable_interrupts(level); mask = ERC32_MEC.Interrupt_Mask; for ( trap=0 ; trap<256 ; trap++ ) { /* * Skip window overflow, underflow, and flush as well as software * trap 0 which we will use as a shutdown. Also avoid trap 0x70 - 0x7f * which cannot happen and where some of the space is used to pass * paramaters to the program. */ if (( trap == 5 || trap == 6 ) || (( trap >= 0x11 ) && ( trap <= 0x1f )) || (( trap >= 0x70 ) && ( trap <= 0x83 ))) continue; set_vector( (rtems_isr_entry) bsp_spurious_handler, SPARC_SYNCHRONOUS_TRAP( trap ), 1 ); } ERC32_MEC.Interrupt_Mask = mask; sparc_enable_interrupts(level);} |
else vmeUniverse0PciIrqLine = irqline; | vmeUniverseFindPciBase( int instance, volatile LERegister **pbase ){int bus,dev,fun;pci_ulong busaddr;unsigned char irqline; if (BSP_PCI_FIND_DEVICE( PCI_VENDOR_TUNDRA, PCI_DEVICE_UNIVERSEII, instance, &bus, &dev, &fun)) return -1; if (BSP_PCI_CONFIG_IN_LONG(bus,dev,fun,PCI_UNIVERSE_BASE0,&busaddr)) return -1; if ((unsigned long)(busaddr) & 1) { /* it's IO space, try BASE1 */ if (BSP_PCI_CONFIG_IN_LONG(bus,dev,fun,PCI_UNIVERSE_BASE1,&busaddr) || ((unsigned long)(busaddr) & 1)) return -1; } *pbase=(volatile LERegister*)PCI_TO_LOCAL_ADDR(busaddr); if (BSP_PCI_CONFIG_IN_BYTE(bus,dev,fun,PCI_INTERRUPT_LINE,&irqline)) return -1; else vmeUniverse0PciIrqLine = irqline; return 0;} |
|
return 0; | BSP_PCI_CONFIG_IN_SHORT(bus, dev, fun, PCI_COMMAND, &wrd); BSP_PCI_CONFIG_OUT_SHORT(bus, dev, fun, PCI_COMMAND, wrd | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); return irqline; | vmeUniverseFindPciBase( int instance, volatile LERegister **pbase ){int bus,dev,fun;pci_ulong busaddr;unsigned char irqline; if (BSP_PCI_FIND_DEVICE( PCI_VENDOR_TUNDRA, PCI_DEVICE_UNIVERSEII, instance, &bus, &dev, &fun)) return -1; if (BSP_PCI_CONFIG_IN_LONG(bus,dev,fun,PCI_UNIVERSE_BASE0,&busaddr)) return -1; if ((unsigned long)(busaddr) & 1) { /* it's IO space, try BASE1 */ if (BSP_PCI_CONFIG_IN_LONG(bus,dev,fun,PCI_UNIVERSE_BASE1,&busaddr) || ((unsigned long)(busaddr) & 1)) return -1; } *pbase=(volatile LERegister*)PCI_TO_LOCAL_ADDR(busaddr); if (BSP_PCI_CONFIG_IN_BYTE(bus,dev,fun,PCI_INTERRUPT_LINE,&irqline)) return -1; else vmeUniverse0PciIrqLine = irqline; return 0;} |
if (!vmeUniverse0BaseAddr && vmeUniverseInit()) return -1; if ((local_addr & 7) != (vme_addr & 7)) { uprintf(stderr,"vmeUniverseStartDMA: misaligned addresses\n"); return -1; } { register volatile LERegister *b=vmeUniverse0BaseAddr; register unsigned long dgcsoff=UNIV_REGOFF_DGCS,dgcs; dgcs=READ_LE(b, dgcsoff); dgcs &= ~UNIV_DGCS_CHAIN; WRITE_LE(dgcs, b, dgcsoff); WRITE_LE(local_addr, b, UNIV_REGOFF_DLA); WRITE_LE(vme_addr, b, UNIV_REGOFF_DVA); WRITE_LE(count, b, UNIV_REGOFF_DTBC); dgcs |= UNIV_DGCS_GO; EIEIO_REG; WRITE_LE(dgcs, b, dgcsoff); } SYNC; return 0; | DFLT_BASE; return vmeUniverseStartDMAXX(base, local_addr, vme_addr, count); | vmeUniverseStartDMA( unsigned long local_addr, unsigned long vme_addr, unsigned long count){ if (!vmeUniverse0BaseAddr && vmeUniverseInit()) return -1; if ((local_addr & 7) != (vme_addr & 7)) { uprintf(stderr,"vmeUniverseStartDMA: misaligned addresses\n"); return -1; } { /* help the compiler allocate registers */ register volatile LERegister *b=vmeUniverse0BaseAddr; register unsigned long dgcsoff=UNIV_REGOFF_DGCS,dgcs; dgcs=READ_LE(b, dgcsoff); /* clear status and make sure CHAIN is clear */ dgcs &= ~UNIV_DGCS_CHAIN; WRITE_LE(dgcs, b, dgcsoff); WRITE_LE(local_addr, b, UNIV_REGOFF_DLA); WRITE_LE(vme_addr, b, UNIV_REGOFF_DVA); WRITE_LE(count, b, UNIV_REGOFF_DTBC); dgcs |= UNIV_DGCS_GO; EIEIO_REG; /* make sure GO is written after everything else */ WRITE_LE(dgcs, b, dgcsoff); } SYNC; /* enforce command completion */ return 0;} |
: "=r"(p) : "r"(p) : "r0" | : "=r"(p) : "0"(p) : "r0" | vmeUniverseCvtToLE(unsigned long *ptr, unsigned long num){#if !defined(__LITTLE_ENDIAN__) || (__LITTLE_ENDIAN__ != 1)register unsigned long *p=ptr+num; while (p > ptr) {#if (defined(_ARCH_PPC) || defined(__PPC__) || defined(__PPC)) && (__BIG_ENDIAN__ == 1) __asm__ __volatile__( "lwzu 0, -4(%0)\n" "stwbrx 0, 0, %0\n" : "=r"(p) : "r"(p) : "r0" );#elif defined(__rtems__) p--; st_le32(p, *p);#else#error "vmeUniverse: endian conversion not implemented for this architecture"#endif }#endif} |
GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); | GEN y, a, cx, xZ; long N = degpol(nf[1]); | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); pari_sp av, tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { gel(y,1) = gcopy(gcoeff(x,1,1)); gel(y,2) = gcopy(gel(x,2)); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gen_1; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { cx = gerepilecopy(av,cx); gel(y,1) = cx; gel(y,2) = gscalcol_i(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { pari_sp av1 = avma; GEN t, y = eltmul_get_table(nf, gel(x,i)); t = FpM_red(y, xZ); if (gcmp0(t)) { avma = av1; continue; } if (ok_elt(x,xZ, t)) { a = gel(x,i); break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ gel(mul,lm) = t; lm++; } if (i > N) { GEN z = cgetg(lm, t_VECSMALL); pari_sp av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); for(av1=avma;;avma=av1) { if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = random_bits(4) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, gel(mul,i)); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], gel(beta,i)); }END: a = centermod(a, xZ); tetpil = avma; gel(y,1) = gmul(xZ,cx); gel(y,2) = gmul(a, cx); gerepilecoeffssp(av,tetpil,y+1,2); return y;} |
if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { gel(y,1) = gcopy(gcoeff(x,1,1)); gel(y,2) = gcopy(gel(x,2)); return y; } | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); pari_sp av, tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { gel(y,1) = gcopy(gcoeff(x,1,1)); gel(y,2) = gcopy(gel(x,2)); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gen_1; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { cx = gerepilecopy(av,cx); gel(y,1) = cx; gel(y,2) = gscalcol_i(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { pari_sp av1 = avma; GEN t, y = eltmul_get_table(nf, gel(x,i)); t = FpM_red(y, xZ); if (gcmp0(t)) { avma = av1; continue; } if (ok_elt(x,xZ, t)) { a = gel(x,i); break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ gel(mul,lm) = t; lm++; } if (i > N) { GEN z = cgetg(lm, t_VECSMALL); pari_sp av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); for(av1=avma;;avma=av1) { if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = random_bits(4) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, gel(mul,i)); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], gel(beta,i)); }END: a = centermod(a, xZ); tetpil = avma; gel(y,1) = gmul(xZ,cx); gel(y,2) = gmul(a, cx); gerepilecoeffssp(av,tetpil,y+1,2); return y;} |
|
a = NULL; beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; for (i=2; i<=N; i++) | if (N < 6) a = get_random_a(nf, x, xZ); else | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); pari_sp av, tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { gel(y,1) = gcopy(gcoeff(x,1,1)); gel(y,2) = gcopy(gel(x,2)); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gen_1; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { cx = gerepilecopy(av,cx); gel(y,1) = cx; gel(y,2) = gscalcol_i(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { pari_sp av1 = avma; GEN t, y = eltmul_get_table(nf, gel(x,i)); t = FpM_red(y, xZ); if (gcmp0(t)) { avma = av1; continue; } if (ok_elt(x,xZ, t)) { a = gel(x,i); break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ gel(mul,lm) = t; lm++; } if (i > N) { GEN z = cgetg(lm, t_VECSMALL); pari_sp av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); for(av1=avma;;avma=av1) { if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = random_bits(4) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, gel(mul,i)); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], gel(beta,i)); }END: a = centermod(a, xZ); tetpil = avma; gel(y,1) = gmul(xZ,cx); gel(y,2) = gmul(a, cx); gerepilecoeffssp(av,tetpil,y+1,2); return y;} |
pari_sp av1 = avma; GEN t, y = eltmul_get_table(nf, gel(x,i)); t = FpM_red(y, xZ); if (gcmp0(t)) { avma = av1; continue; } if (ok_elt(x,xZ, t)) { a = gel(x,i); break; } beta[lm]= x[i]; gel(mul,lm) = t; lm++; | const long lim = 47; GEN a1, fa = auxdecomp(xZ, lim), P = gel(fa,1), E = gel(fa,2); long l = lg(P)-1; a1 = powgi(gel(P, l), gel(E, l)); if (cmpis(a1, lim) <= 0) a = idealapprfact_i(nf, idealfactor(nf,x), 1); else if (equalii(xZ, a1)) a = get_random_a(nf, x, xZ); else { GEN A0, A1, a0, u0, u1, v0, v1, pi0, pi1, t, u; a0 = diviiexact(xZ, a1); A0 = hnfmodid(x, a0); A1 = hnfmodid(x, a1); pi0 = idealapprfact_i(nf, idealfactor(nf,A0), 1); pi1 = get_random_a(nf, A1, a1); (void)bezout(a0, a1, &v0,&v1); u0 = gmul(a0, v0); u1 = gmul(a1, v1); t = gmul(pi0, u1); gel(t,1) = gadd(gel(t,1), u0); u = gmul(pi1, u0); gel(u,1) = gadd(gel(u,1), u1); a = element_muli(nf, centermod(u, xZ), centermod(t, xZ)); } | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); pari_sp av, tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { gel(y,1) = gcopy(gcoeff(x,1,1)); gel(y,2) = gcopy(gel(x,2)); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gen_1; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { cx = gerepilecopy(av,cx); gel(y,1) = cx; gel(y,2) = gscalcol_i(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { pari_sp av1 = avma; GEN t, y = eltmul_get_table(nf, gel(x,i)); t = FpM_red(y, xZ); if (gcmp0(t)) { avma = av1; continue; } if (ok_elt(x,xZ, t)) { a = gel(x,i); break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ gel(mul,lm) = t; lm++; } if (i > N) { GEN z = cgetg(lm, t_VECSMALL); pari_sp av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); for(av1=avma;;avma=av1) { if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = random_bits(4) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, gel(mul,i)); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], gel(beta,i)); }END: a = centermod(a, xZ); tetpil = avma; gel(y,1) = gmul(xZ,cx); gel(y,2) = gmul(a, cx); gerepilecoeffssp(av,tetpil,y+1,2); return y;} |
if (i > N) { GEN z = cgetg(lm, t_VECSMALL); pari_sp av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); for(av1=avma;;avma=av1) { if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = random_bits(4) - 7; z[i] = t; a = addmul_mat(a, t, gel(mul,i)); } if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], gel(beta,i)); } END: | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); pari_sp av, tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { gel(y,1) = gcopy(gcoeff(x,1,1)); gel(y,2) = gcopy(gel(x,2)); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gen_1; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { cx = gerepilecopy(av,cx); gel(y,1) = cx; gel(y,2) = gscalcol_i(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { pari_sp av1 = avma; GEN t, y = eltmul_get_table(nf, gel(x,i)); t = FpM_red(y, xZ); if (gcmp0(t)) { avma = av1; continue; } if (ok_elt(x,xZ, t)) { a = gel(x,i); break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ gel(mul,lm) = t; lm++; } if (i > N) { GEN z = cgetg(lm, t_VECSMALL); pari_sp av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); for(av1=avma;;avma=av1) { if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = random_bits(4) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, gel(mul,i)); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], gel(beta,i)); }END: a = centermod(a, xZ); tetpil = avma; gel(y,1) = gmul(xZ,cx); gel(y,2) = gmul(a, cx); gerepilecoeffssp(av,tetpil,y+1,2); return y;} |
|
y=gun; ms=gneg_i(s); p1=cgetr(prec+1); | y=gun; ms=gneg_i(s); p1=cgetr(prec+1); p2=gun; | czeta(GEN s, long prec){ long av,n,p,n1,l,flag1,flag2,flag3,i,i2; double st,sp,sn,ssig,ns,alpha,beta,maxbeta,xinf; GEN y,z,res,sig,ms,p1,p2,p3,p31,pitemp; l=precision(s); if (typ(s)==t_COMPLEX) { if (!l) l=prec; res=cgetg(3,t_COMPLEX); res[1]=lgetr(l); res[2]=lgetr(l); av=avma; p1=cgetg(3,t_COMPLEX); p1[1]=lgetr(l+1); p1[2]=lgetr(l+1); gaffect(s,p1); s=p1; sig=(GEN)s[1]; } else { res = cgetr(l); av=avma; p1=cgetr(l+1); affrr(s,p1); sig=s=p1; } if (signe(sig)>0 && expo(sig)>-2) flag1 = 0; else { if (gcmp0(gimag(s)) && gcmp0(gfrac(gmul2n(sig,-1)))) { if (gcmp0(sig)) gaffect(gneg_i(ghalf),res); else gaffsg(0,res); avma=av; return res; } flag1=1; s=gsub(gun,s); sig=greal(s); } ssig=rtodbl(sig); st=fabs(rtodbl(gimag(s))); maxbeta = pow(3.0,-2.5); if (st) { ns = ssig*ssig + st*st; alpha=pariC2*(prec-2)-0.39-0.5*(ssig-1.0)*log(ns)-log(ssig)+ssig*2*pariC1; beta=(alpha+ssig)/st-atan(ssig/st); if (beta<=0) { if (ssig>=1.0) { p=0; sn=sqrt(ns); n=(long)(ceil(exp(pariC2*(prec-2)/ssig)*pow(sn/(2*ssig),1.0/ssig))); } else { p=1; sn=ssig+1; n=(long)ceil(sqrt(sn*sn+st*st)/(2*PI)); } } else { if (beta<maxbeta) xinf=beta+pow(3*beta,1.0/3.0); else { double eps=0.0087, x00 = beta+PI/2.0, y00,x11; for(;;) { y00=x00*x00; x11=(beta+atan(x00))*(1+y00)/y00-1/x00; if (x00-x11 < eps) break; x00 = x11; } xinf=x11; } sp=1.0-ssig+st*xinf; if (sp>0) { p=(long)ceil(sp/2.0); sn=ssig+2*p-1; n=(long)ceil(sqrt(sn*sn+st*st)/(2*PI)); } else { p=0; sn=sqrt(ns); n=(long)ceil(exp(pariC2*(prec-2)/ssig)*pow(sn/(2*ssig),1.0/ssig)); } } } else { beta=pariC2*(prec-2)+0.61+ssig*2*pariC1-ssig*log(ssig); if (beta>0) { p=(long)ceil(beta/2.0); sn=ssig+2*p-1; n=(long)ceil(sqrt(sn*sn+st*st)/(2*PI)); } else { p=0; sn=sqrt(ssig*ssig+st*st); n=(long)ceil(exp(pariC2*(prec-2)/ssig)*pow(sn/(2*ssig),1.0/ssig)); } } if (n < 46340) { flag2=1; n1=n*n; } else flag2=0; y=gun; ms=gneg_i(s); p1=cgetr(prec+1); for (i=2; i<=n; i++) { affsr(i,p1); p2 = gexp(gmul(ms,mplog(p1)), prec+1); y = gadd(y,p2); } flag3 = (2*p < 46340); mpbern(p,prec+1); p31=cgetr(prec+1); z=gzero; for (i=p; i>=1; i--) { i2=i<<1; p1=gmul(gaddsg(i2-1,s),gaddsg(i2,s)); p1=flag3? gdivgs(p1,i2*(i2+1)): gdivgs(gdivgs(p1,i2),i2+1); p1=flag2? gdivgs(p1,n1): gdivgs(gdivgs(p1,n),n); p3 = bern(i); if (bernzone[2]>prec+1) { affrr(p3,p31); p3=p31; } z=gadd(divrs(p3,i),gmul(p1,z)); } p1=gsub(gdivsg(n,gsubgs(s,1)),ghalf); z=gmul(gadd(p1,gmul(s,gdivgs(z,n<<1))),p2); y = gadd(y,z); if (flag1) { pitemp=mppi(prec+1); setexpo(pitemp,2); y=gmul(gmul(y,ggamma(s,prec+1)),gpui(pitemp,ms,prec+1)); setexpo(pitemp,0); y=gmul2n(gmul(y,gcos(gmul(pitemp,s),prec+1)),1); } gaffect(y,res); avma=av; return res;} |
if (typ(x) != t_MAT) err(typeer,"minim0"); | if (typ(a) != t_MAT) err(typeer,"minim0"); | minim0(GEN a, GEN BORNE, GEN STOCKMAX, long flag){ GEN x,res,p1,u,r,L,gnorme,invp,V; long n = lg(a), i, j, k, s, maxrank; pari_sp av0 = avma, av1, av, lim; double p,maxnorm,BOUND,*v,*y,*z,**q, eps = 0.000001; BORNE = gfloor(BORNE); if (typ(BORNE) != t_INT || typ(STOCKMAX) != t_INT) err(typeer, "minim0"); if (typ(x) != t_MAT) err(typeer,"minim0"); maxrank = 0; res = V = invp = NULL; /* gcc -Wall */ switch(flag) { case min_FIRST: if (gcmp0(BORNE)) err(talker,"bound = 0 in minim2"); res = cgetg(3,t_VEC); break; case min_ALL: res = cgetg(4,t_VEC); break; case min_PERF: break; case min_VECSMALL: case min_VECSMALL2: maxrank = itos(BORNE); if (maxrank <= 0) return cgetg(1, t_VECSMALL); res = const_vecsmall(maxrank, 0); if (flag == min_VECSMALL2) BORNE = shifti(BORNE,1); if (gcmp0(BORNE)) return res; break; default: err(talker, "incorrect flag in minim0"); } if (n == 1) { switch(flag) { case min_FIRST: avma=av0; return cgetg(1,t_VEC); case min_VECSMALL: case min_VECSMALL2: return res; case min_PERF: avma=av0; return gen_0; } gel(res,1) = gel(res,2) = gen_0; gel(res,3) = cgetg(1,t_MAT); return res; } av = avma; minim_alloc(n, &q, &x, &y, &z, &v); av1 = avma; u = lllgramint(a); if (lg(u) != n) err(talker,"not a definite form in minim0"); a = qf_base_change(a,u,1); n--; a = mat_to_MP(a, DEFAULTPREC); r = sqred1(a); for (j=1; j<=n; j++) { v[j] = rtodbl(gcoeff(r,j,j)); for (i=1; i<j; i++) q[i][j] = rtodbl(gcoeff(r,i,j)); } if (flag==min_PERF || gcmp0(BORNE)) { double c, b = rtodbl(gcoeff(a,1,1)); for (i=2; i<=n; i++) { c = rtodbl(gcoeff(a,i,i)); if (c < b) b = c; } BOUND = b+eps; BORNE = ground(dbltor(BOUND)); maxnorm = -1.; /* don't update maxnorm */ } else { BOUND = gtodouble(BORNE)+eps; maxnorm = 0.; } switch(flag) { case min_ALL: maxrank = itos(STOCKMAX); if (maxrank < 0) err(talker,"negative number of vectors in minim0"); L = new_chunk(1+maxrank); break; case min_PERF: BORNE = gerepileupto(av1,BORNE); maxrank = (n*(n+1)) >> 1; L = const_vecsmall(maxrank, 0); V = cgetg(1+maxrank, t_VECSMALL); } s = 0; av1 = avma; lim = stack_lim(av1,1); k = n; y[n] = z[n] = 0; x[n] = (long)sqrt(BOUND/v[n]); if (flag == min_PERF) invp = matid(maxrank); for(;;x[1]--) { do { if (k>1) { long l = k-1; z[l] = 0; for (j=k; j<=n; j++) z[l] += q[l][j]*x[j]; p = (double)x[k] + z[k]; y[l] = y[k] + p*p*v[k]; x[l] = (long)floor(sqrt((BOUND-y[l])/v[l])-z[l]); k = l; } for(;;) { p = (double)x[k] + z[k]; if (y[k] + p*p*v[k] <= BOUND) break; k++; x[k]--; } } while (k > 1); if (! x[1] && y[1]<=eps) break; p = (double)x[1] + z[1]; p = y[1] + p*p*v[1]; /* norm(x) */ if (maxnorm >= 0) { if (flag == min_FIRST) { gel(res,2) = gerepileupto(av, ZM_zc_mul(u,x)); av = avma; gel(res,1) = gerepileupto(av, ground(dbltor(p))); return res; } if (p > maxnorm) maxnorm = p; } else { pari_sp av2 = avma; gnorme = ground(dbltor(p)); if (gcmp(gnorme,BORNE) >= 0) avma = av2; else { BOUND=gtodouble(gnorme)+eps; s=0; affii(gnorme,BORNE); avma = av1; if (flag == min_PERF) invp = matid(maxrank); } } s++; switch(flag) { case min_ALL: if (s<=maxrank) { p1 = new_chunk(n+1); gel(L,s) = p1; for (i=1; i<=n; i++) p1[i] = x[i]; } break; case min_VECSMALL: { ulong norm = (ulong)(p + 0.5); res[norm]++; } break; case min_VECSMALL2: { ulong norm = (ulong)(p + 0.5); if ((norm&1) == 0) res[norm>>1]++; } break; case min_PERF: { long I=1; pari_sp av2=avma; for (i=1; i<=n; i++) for (j=i; j<=n; j++,I++) V[I] = x[i]*x[j]; if (! addcolumntomatrix(V,invp,L)) { if (DEBUGLEVEL>1) { fprintferr("."); flusherr(); } s--; avma=av2; continue; } if (DEBUGLEVEL>1) { fprintferr("*"); flusherr(); } if (s == maxrank) { if (DEBUGLEVEL>1) { fprintferr("\n"); flusherr(); } avma=av0; return stoi(s); } if (low_stack(lim, stack_lim(av1,1))) { if(DEBUGMEM>1) err(warnmem,"minim0, rank>=%ld",s); invp = gerepilecopy(av1, invp); } } } } switch(flag) { case min_FIRST: avma=av0; return cgetg(1,t_VEC); case min_VECSMALL: case min_VECSMALL2: avma=av; return res; case min_PERF: if (DEBUGLEVEL>1) { fprintferr("\n"); flusherr(); } avma=av0; return stoi(s); } k = min(s,maxrank); r = (maxnorm >= 0) ? ground(dbltor(maxnorm)): BORNE; L[0] = evaltyp(t_MAT) | evallg(k + 1); for (j=1; j<=k; j++) gel(L,j) = ZM_zc_mul(u, gel(L,j)); gerepileall(av, 2, &r, &L); gel(res,1) = stoi(s<<1); gel(res,2) = r; gel(res,3) = L; return res;} |
char buffer[256]; | void canonical_input( struct termios *tp ){ char c, first_time = TRUE; printf( "\nTesting canonical input\n\n" ); printf( "Setting line to canonical input mode.\n" ); tp->c_lflag = ISIG | ICANON | ECHO | ECHONL | ECHOK | ECHOE | ECHOPRT | ECHOCTL | IEXTEN; tp->c_iflag = BRKINT | ICRNL | IXON | IMAXBEL; if( tcsetattr( fileno( stdin ), TCSADRAIN, tp ) < 0 ) { perror( "canonical_input(): tcsetattr() failed" ); exit( 1 ); } while ( ( c = getchar () ) != '\n'); printf( "Testing getchar(). Type some text followed by carriage return\n" ); printf( "Each character you entered will be echoed back to you\n\n" ); while ( ( c = getchar () ) != '\n') { if( first_time ) { printf( "\nYou typed:\n"); first_time = FALSE; } printf( "%c", c ); } printf( "\n\nCanonical input test done.\n" );} |
|
if (N==1) { S=cgetg(2,t_VEC); S[1]=(long)polx[v0]; return S; } | if (N==1) return _vec(polx[v0]); | conjugates(GEN pol){ long av,tetpil,N,i,j,pp,bound_primes,nbprimes,longT,v0,flL,f,longTnew,*tab,nop; GEN T,S,p1,p2,p,dpol,modunp,polp,xbar,frobp,frob,d,B,nf; byteptr di; if (DEBUGLEVEL>2){ fprintferr("** Entree dans conjugates\n"); flusherr(); } if (typ(pol)==t_POL) nf = NULL; else { nf = checknf(pol); pol=(GEN)nf[1]; } av=avma; N=deg(pol); v0=varn(pol); if (N==1) { S=cgetg(2,t_VEC); S[1]=(long)polx[v0]; return S; } if (N==2) { S=cgetg(3,t_VEC); S[1]=(long)polx[v0]; S[2]=lsub(gneg(polx[v0]),(GEN)pol[3]); tetpil=avma; return gerepile(av,tetpil,gcopy(S)); } dpol=absi(discsr(pol)); if (DEBUGLEVEL>2) { fprintferr("discriminant du polynome: "); outerr(dpol); } d = nf? (GEN)nf[4]: compute_denom(dpol); if (DEBUGLEVEL>2) { fprintferr("facteur carre du discriminant: "); outerr(d); } B=compute_bound_for_lift(pol,dpol,d); if (DEBUGLEVEL>2) { fprintferr("borne pour les lifts: "); outerr(B); } /* sous GRH il faut en fait 3.47*log(dpol) */ p1=gfloor(glog(dpol,DEFAULTPREC)); bound_primes=itos(p1); if (DEBUGLEVEL>2) { fprintferr("borne pour les premiers: %ld\n",bound_primes); flusherr(); } nbprimes=itos(gfloor(gmul(dbltor(1.25506), gdiv(p1,glog(p1,DEFAULTPREC))))); if (DEBUGLEVEL>2) { fprintferr("borne pour le nombre de premiers: %ld\n",nbprimes); flusherr(); } S=cgetg(nbprimes+1,t_VEC); di=diffptr; pp=*di; i=0; while (pp<=bound_primes) { if (smodis(dpol,pp)) { i++; S[i]=lstoi(pp); } pp = pp + (*(++di)); } for (j=i+1; j<=nbprimes; j++) S[j]=zero; nbprimes=i; tab=new_chunk(nbprimes+1); for (i=1; i<=nbprimes; i++) tab[i]=0; if (DEBUGLEVEL>2) { fprintferr("nombre de premiers: %ld\n",nbprimes); fprintferr("table des premiers: "); outerr(S); } T=cgetg(N+1,t_VEC); T[1]=(long)polx[v0]; for (i=2; i<=N; i++) T[i]=zero; longT=1; if (DEBUGLEVEL>2) { fprintferr("table initiale: "); outerr(T); } for(;;) { do { do { nop = 1+itos(shifti(mulss(mymyrand(),nbprimes),-(BITS_IN_RANDOM-1))); } while (tab[nop]); tab[nop]=1; p=(GEN)S[nop]; if (DEBUGLEVEL>2) { fprintferr("\nnombre premier: "); outerr(p); } modunp=gmodulsg(1,p); polp=gmul(modunp,pol); xbar=gmodulcp(gmul(polx[v0],modunp),polp); frobp=gpui(xbar,p,4); if (DEBUGLEVEL>2) { fprintferr("frobenius mod p: "); outerr(frobp); } flL=isinlistmodp(T,longT,frobp,p); if (DEBUGLEVEL>2){ fprintferr("flL: %ld\n",flL); flusherr(); } } while (flL); f=minimalexponent(T,longT,frobp,p,N); if (DEBUGLEVEL>2){ fprintferr("exposant minimum: %ld\n",f); flusherr(); } frob=frobenius(pol,frobp,p,B,d); if (DEBUGLEVEL>2) { fprintferr("frobenius: "); outerr(frob); }/* Ce passage n'est vrai que si le corps est abelien !! */ longTnew=longT; p2=gmodulcp(frob,pol); for (i=1; i<=longTnew; i++) for (j=1; j<f; j++) { p1=lift(gsubst((GEN)T[i],v0,gpuigs(p2,j))); if (DEBUGLEVEL>2) { fprintferr("test de la puissance (%ld,%ld): ",i,j); outerr(p1); } if (!isinlist(T,longTnew,p1)) { longT++; T[longT]=(long)p1; if (longT==N) { if (DEBUGLEVEL>2) { fprintferr("** Sortie de conjugates\n"); flusherr(); } tetpil=avma; return gerepile(av,tetpil,gcopy(T)); } } } if (DEBUGLEVEL>2) { fprintferr("nouvelle table: "); outerr(T); } }} |
for (i=1; i<=n; i++) | for (i=1+(j==1); i<=n; i++) | mathilbert(long n) /* Hilbert matrix of order n */{ long i,j; GEN a,p; if (n<0) n = 0; p = cgetg(n+1,t_MAT); for (j=1; j<=n; j++) { p[j]=lgetg(n+1,t_COL); for (i=1; i<=n; i++) { a=cgetg(3,t_FRAC); a[1]=un; a[2]=lstoi(i+j-1); coeff(p,i,j)=(long)a; } } return p;} |
if ( n ) mael(p,1,1)=un; | mathilbert(long n) /* Hilbert matrix of order n */{ long i,j; GEN a,p; if (n<0) n = 0; p = cgetg(n+1,t_MAT); for (j=1; j<=n; j++) { p[j]=lgetg(n+1,t_COL); for (i=1; i<=n; i++) { a=cgetg(3,t_FRAC); a[1]=un; a[2]=lstoi(i+j-1); coeff(p,i,j)=(long)a; } } return p;} |
|
case PPC_604r: | int mpc60x_vector_is_valid(rtems_vector vector){ switch (current_ppc_cpu) { case PPC_7400: case PPC_750: if (!mpc750_vector_is_valid(vector)) { return 0; } break; case PPC_604: case PPC_604e: /* case PPC_604r: -- same value as PPC_750 */ if (!mpc604_vector_is_valid(vector)) { return 0; } break; case PPC_603: case PPC_603e: case PPC_603ev: if (!mpc603_vector_is_valid(vector)) { return 0; } break; default: printk("Please complete libcpu/powerpc/mpc6xx/raw_exception.c\n"); printk("current_ppc_cpu = %x\n", current_ppc_cpu); return 0; } return 1;} |
|
printk("Please complete libcpu/powerpc/mpc6xx/raw_exception.c\n"); | printk("Please complete libcpu/powerpc/mpc6xx/exceptions/raw_exception.c\n"); | int mpc60x_vector_is_valid(rtems_vector vector){ switch (current_ppc_cpu) { case PPC_7400: case PPC_750: if (!mpc750_vector_is_valid(vector)) { return 0; } break; case PPC_604: case PPC_604e: /* case PPC_604r: -- same value as PPC_750 */ if (!mpc604_vector_is_valid(vector)) { return 0; } break; case PPC_603: case PPC_603e: case PPC_603ev: if (!mpc603_vector_is_valid(vector)) { return 0; } break; default: printk("Please complete libcpu/powerpc/mpc6xx/raw_exception.c\n"); printk("current_ppc_cpu = %x\n", current_ppc_cpu); return 0; } return 1;} |
printk("Please complete libcpu/powerpc/XXX/raw_exception.c\n"); | switch(vector) { case ASM_RESET_VECTOR: case ASM_MACH_VECTOR: case ASM_PROT_VECTOR: case ASM_ISI_VECTOR: case ASM_EXT_VECTOR: case ASM_ALIGN_VECTOR: case ASM_PROG_VECTOR: case ASM_FLOAT_VECTOR: case ASM_DEC_VECTOR: case ASM_SYS_VECTOR: case ASM_TRACE_VECTOR: case ASM_PERFMON_VECTOR: return 1; case ASM_IMISS_VECTOR: case ASM_DLMISS_VECTOR: case ASM_DSMISS_VECTOR: return 0; case ASM_ADDR_VECTOR: case ASM_SYSMGMT_VECTOR: return 1; case ASM_ITM_VECTOR: return 0; } | int mpc604_vector_is_valid(rtems_vector vector){ /* * Please fill this for MVME2307 */ printk("Please complete libcpu/powerpc/XXX/raw_exception.c\n"); return 0;} |
GEN q, bas, invbas, mul, dK, nf, fa, g, e, dx = absi(ZX_disc(x)); | GEN q, bas, invbas, mul, dK, nf, g, e, dx = absi(ZX_disc(x)); | padicff(GEN x,GEN p,long pr){ pari_sp av = avma; GEN q, bas, invbas, mul, dK, nf, fa, g, e, dx = absi(ZX_disc(x)); long n = degpol(x), v = Z_pvalrem(dx,p,&q); nf = cgetg(10,t_VEC); nf[1] = (long)x; if (is_pm1(q)) { e = mkcol(utoi(v)); g = mkcol(p); } else { e = mkcol2(stoi(v), gen_1); g = mkcol2(p, q); } fa = cgetg(3,t_MAT); fa[1] = (long)g; fa[2] = (long)e; bas = nfbasis(x, &dK, 0, fa); nf[3] = (long)dK; nf[4] = dvdii( diviiexact(dx, dK), p )? (long)p: (long)gen_1; invbas = QM_inv(RgXV_to_RgM(bas,n), gen_1); mul = get_mul_table(x,bas,invbas); nf[7]=(long)bas; nf[8]=(long)invbas; nf[9]=(long)mul; nf[2]=nf[5]=nf[6]= (long)gen_0; return gerepileupto(av,padicff2(nf,p,pr));} |
e = mkcol2(stoi(v), gen_1); | e = mkcol2(utoi(v), gen_1); | padicff(GEN x,GEN p,long pr){ pari_sp av = avma; GEN q, bas, invbas, mul, dK, nf, fa, g, e, dx = absi(ZX_disc(x)); long n = degpol(x), v = Z_pvalrem(dx,p,&q); nf = cgetg(10,t_VEC); nf[1] = (long)x; if (is_pm1(q)) { e = mkcol(utoi(v)); g = mkcol(p); } else { e = mkcol2(stoi(v), gen_1); g = mkcol2(p, q); } fa = cgetg(3,t_MAT); fa[1] = (long)g; fa[2] = (long)e; bas = nfbasis(x, &dK, 0, fa); nf[3] = (long)dK; nf[4] = dvdii( diviiexact(dx, dK), p )? (long)p: (long)gen_1; invbas = QM_inv(RgXV_to_RgM(bas,n), gen_1); mul = get_mul_table(x,bas,invbas); nf[7]=(long)bas; nf[8]=(long)invbas; nf[9]=(long)mul; nf[2]=nf[5]=nf[6]= (long)gen_0; return gerepileupto(av,padicff2(nf,p,pr));} |
fa = cgetg(3,t_MAT); fa[1] = (long)g; fa[2] = (long)e; bas = nfbasis(x, &dK, 0, fa); | bas = nfbasis(x, &dK, 0, mkmat2(g,e)); | padicff(GEN x,GEN p,long pr){ pari_sp av = avma; GEN q, bas, invbas, mul, dK, nf, fa, g, e, dx = absi(ZX_disc(x)); long n = degpol(x), v = Z_pvalrem(dx,p,&q); nf = cgetg(10,t_VEC); nf[1] = (long)x; if (is_pm1(q)) { e = mkcol(utoi(v)); g = mkcol(p); } else { e = mkcol2(stoi(v), gen_1); g = mkcol2(p, q); } fa = cgetg(3,t_MAT); fa[1] = (long)g; fa[2] = (long)e; bas = nfbasis(x, &dK, 0, fa); nf[3] = (long)dK; nf[4] = dvdii( diviiexact(dx, dK), p )? (long)p: (long)gen_1; invbas = QM_inv(RgXV_to_RgM(bas,n), gen_1); mul = get_mul_table(x,bas,invbas); nf[7]=(long)bas; nf[8]=(long)invbas; nf[9]=(long)mul; nf[2]=nf[5]=nf[6]= (long)gen_0; return gerepileupto(av,padicff2(nf,p,pr));} |
top_of_used_memory = (rtems_unsigned32) &end + 0x1000; | top_of_used_memory = (uint32_t) &end + 0x1000; | int rx_boot_card( int argc, char **argv, char **environp){ extern int end; top_of_used_memory = (rtems_unsigned32) &end + 0x1000; if ((argc > 0) && argv && argv[0]) rtems_progname = argv[0]; else rtems_progname = "RTEMS/RP"; boot_card(argc, argv);} |
long group,omax; | long group; | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
Fpe=cgetg(lg(Fp), t_VECSMALL); | Fpe=cgetg(np+1, t_VECSMALL); | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
omax=0; | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
|
long o,norm_o; | long o,norm_o=1; | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { if (o * Fp[1] >= n) norm_o = o; else | if (o % order == 0) { if (o * Fp[1] >= n) norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } | if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
if (norm_o != 1) | } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |
if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; | deg = norm_o; | galoisanalysis(GEN T, struct galois_analysis *ga, long calcul_l){ ulong ltop=avma; long n,p; long i; long group,omax; /*TODO: complete the table to at least 200*/ const int prim_nonss_orders[]={36,48,56,60,72,75,80,96,108,0}; GEN F,Fp,Fe,Fpe,O; long np; long order,phi_order; long plift,nbmax,nbtest,deg; byteptr primepointer,pp; if (DEBUGLEVEL >= 1) timer2(); n = degree(T); O = cgetg(n+1,t_VECSMALL); for(i=1;i<=n;i++) O[i]=0; F = factor(stoi(n)); Fp=vectosmall((GEN)F[1]); Fe=vectosmall((GEN)F[2]); np=lg(Fp)-1; Fpe=cgetg(lg(Fp), t_VECSMALL); for (i = 1; i < lg(Fpe); i++) Fpe[i] = itos(powgi(gmael(F,1,i), gmael(F,2,i))); /*In this part, we study the cardinal of the group to have an information about the orders, so if we are unlucky we can continue.*/ /*Are there non WSS groups of this order ?*/ group=0; for(i=0;prim_nonss_orders[i];i++) if (n%prim_nonss_orders[i] == 0) group |= ga_non_wss; if ( n>12 && n%12 == 0 ) { /*We need to know the greatest prime dividing n/12*/ if ( Fp[np] == 3 && Fe[np] == 1 ) group |= ga_ext_2; } phi_order = 1; order = 1; for (i = np; i > 0; i--) { p = Fp[i]; if (phi_order % p != 0) { order *= p; phi_order *= p - 1; } else { group |= ga_all_normal; break; } if (Fe[i]>1) break; } /*Now, we study the orders of the Frobenius elements*/ plift = 0; omax=0; nbmax = 8+(n>>1); nbtest = 0; deg = 0; for (p = 0, pp = primepointer = diffptr; (plift == 0 || (nbtest < nbmax && order != n && (nbtest <=8 || order != (n>>1))) || (n == 24 && O[6] == 0 && O[4] == 0)) && (nbtest < 3 * nbmax || (!(group&ga_non_wss) && n%12 ) ) ;) { ulong av; long prime_incr; GEN ip,FS,p1; long o,norm_o; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; /*discard small primes*/ if (p <= (n << 1)) continue; ip=stoi(p); if (!Fp_is_squarefree(T,ip)) continue; nbtest++; av=avma; FS=(GEN)simplefactmod(T,ip)[1]; p1=(GEN)FS[1]; for(i=2;i<lg(FS);i++) if (cmpii(p1,(GEN)FS[i])) break; if (i<lg(FS)) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } o=n/(lg(FS)-1); avma=av; if (!O[o]) O[o]=p; if (DEBUGLEVEL >= 6) fprintferr("GaloisAnalysis:Nbtest=%ld,p=%ld,o=%ld,plift=%ld,ord=%ld\n", nbtest, p, o, plift, order); if (o > omax) omax = o; if (o >= order) { /*We try to find a power of the Frobenius which generate a normal subgroup just by looking at the order.*/ if (o * Fp[1] >= n) /*Subgroup of smallest index are normal*/ norm_o = o; else { norm_o = 1; for (i = np; i > 0; i--) { if (o % Fpe[i] == 0) norm_o *= Fpe[i]; else break; } } if (norm_o != 1) { if (!(group&ga_all_normal) || o > order || (o == order && (plift == 0 || norm_o > deg))) { deg = norm_o; order = o; plift = p; pp = primepointer; group |= ga_all_normal; } } else if (!(group&ga_all_normal) && (plift == 0 || o > order)) { deg = Fp[np]; order = o; plift = p; pp = primepointer; } } } /* This is to avoid looping on non-wss group. To be completed*/ if (plift == 0 || /*I am not 100% sure of this one, at least it is right for n<=72*/ (n > 24 && n%12 == 0 && Fp[np]==3 && !O[6]) || ((group&ga_non_wss) && omax == Fp[np])) { deg = 0; err(warner, "Galois group almost certainly not weakly super solvable"); } if (calcul_l && !O[1]) { ulong av; long prime_incr; long l=0; /*we need a totally splited prime l*/ av = avma; while (l == 0) { long nb; prime_incr = *primepointer++; if (!prime_incr) err(primer1); p += prime_incr; nb=FpX_nbroots(T,stoi(p)); if (nb == n) l = p; else if (nb && Fp_is_squarefree(T,stoi(p))) { avma = ltop; if (DEBUGLEVEL >= 2) fprintferr("GaloisAnalysis:non Galois for p=%ld\n", p); ga->p = p; ga->deg = 0; return; /* Not a Galois polynomial */ } avma = av; } O[1]=l; } ga->p = plift; ga->group = group; ga->deg = deg; ga->ord = order; ga->l = O[1]; ga->primepointer = pp; ga->ppp = Fp[1]; ga->p4 = O[4]; if (DEBUGLEVEL >= 4) fprintferr("GaloisAnalysis:p=%ld l=%ld group=%ld deg=%ld ord=%ld\n", p, O[1], group, deg, order); if (DEBUGLEVEL >= 1) msgtimer("galoisanalysis()"); avma = ltop;} |