| Karim Belabas on Thu, 20 Nov 1997 21:00:06 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| patch6 |
Yet another patch. Again a bug report by Gerhard (msg 13):
> (20:27) gp > idealnorm(nf,x)
> %34 = 133
> (20:28) gp > idealnorm(nf,Mod(x,nf.pol))
> *** incorrect type in gabs.
That turns out to be an inocuous bug in nfbasistoalg(). When fed a
t_POLMOD, it would convert it to a higher (meaningless) polmod instead of
just copying it back. I added an extra consistency check as well.
Karim.
============================ patch 6 (2.0.alpha) ===========================
*** src/basemath/base3.c.orig Fri Nov 14 04:53:17 1997
--- src/basemath/base3.c Thu Nov 20 20:42:59 1997
***************
*** 446,451 ****
--- 446,463 ----
avma=av; return v;
}
+ /* polegal without comparing variables */
+ long
+ polegal_spec(GEN x, GEN y)
+ {
+ long i = lgef(x);
+
+ if (i != lgef(y)) return 0;
+ for (i--; i > 1; i--)
+ if (!gegal((GEN)x[i],(GEN)y[i])) return 0;
+ return 1;
+ }
+
GEN
basistoalg(GEN nf, GEN x)
{
***************
*** 472,477 ****
--- 484,493 ----
for (i=1; i<lx; i++) z[i]=(long)basistoalg(nf,(GEN)x[i]);
return z;
+ case t_POLMOD:
+ if (!polegal_spec((GEN)nf[1],(GEN)x[1]))
+ err(talker,"not the same number field in basistoalg");
+ return gcopy(x);
default: z=cgetg(3,t_POLMOD); z[1]=lcopy((GEN)nf[1]);
z[2]=lmul(x,polun[varn(nf[1])]); return z;
}
***************
*** 499,516 ****
return z;
}
- /* polegal without comparing variables */
- long
- polegal_spec(GEN x, GEN y)
- {
- long i = lgef(x);
-
- if (i != lgef(y)) return 0;
- for (i--; i > 1; i--)
- if (!gegal((GEN)x[i],(GEN)y[i])) return 0;
- return 1;
- }
-
GEN
algtobasis(GEN nf, GEN x)
{
--- 515,520 ----
--
Karim Belabas e-mail:
Max-Planck-Institut fuer Mathematik karim@mpim-bonn.mpg.de
Gottfried-Claren-Str. 26 tel:
53225 Bonn (Germany) (00 49 228) 402-245