| Bill Allombert on Mon, 15 Jun 2009 17:26:20 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: idealadd() details |
On Mon, Jun 15, 2009 at 04:46:21PM +0200, Jeroen Demeyer wrote:
> Hello list,
>
> I have a question about idealadd(). Either I'm misunderstanding
> something, or the implementation is wrong, or the documentation is wrong.
>
> Consider the following:
> gp> idealadd(nfinit(t^2+1), [1,0;0,2], [1,0;0,2])
> %20 =
> [1 0]
>
> [0 1]
>
> Here I expected to get [1,0;0,2] as a result, since the documentation
> states it just adds Z-modules. Of course, as ideals, the answer is
> correct.
The documentation agree with you (even if it is weird for idealadd to
do that).
The variant below works (which is equivalent as Z-modules)
? idealadd(nfinit(t^2+1), [2,0;0,1], [2,0;0,1])
%1 =
[2 0]
[0 1]
so this look like a bug caused by this shortcut (in idealadd)
a = gcdii(gcoeff(x,1,1), gcoeff(y,1,1));
if (is_pm1(a))
{
long N = lg(x)-1;
if (!dz) { avma = av; return matid(N); }
return gerepileupto(av, scalarmat(ginv(dz), N));
}
Cheers,
Bill.