| Karim BELABAS on Wed, 15 Sep 1999 12:53:32 +0200 (MET DST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [PARI-2.0.x.beta, x>14] Strange behavior of matdet |
> I have noticed the following (cumbersome) problem with matdet, as the title
> suggests it occurs with all the available versions of PARI-2.0.x, with
> x>14. (see below for the config).
>
> Set
>
> P=[-290,107,0,0,0,0,0;-2713,1001,0,0,0,0,0;0,0,-3, 2, -5, 1, -1;0,0,-1,
> -1, -2, -2, -1;0,0,1 , 1, 3, 10, 2;0,0,33, 0, 1, 32, 5;0,0, 1,
> 1, 3, -1, 1];
>
> then
>
> (23:41) gp > matdet(P)
> %2 = -2051114900000 <--- Wrong answer ....
A (bad) typo in det() [forget to divide by a pivot in rare cases], indeed
introduced in 2.0.15. Here's a fix.
Karim.
Index: src/basemath/alglin1.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/alglin1.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 alglin1.c
*** src/basemath/alglin1.c 1999/09/09 15:48:45 1.1.1.1
--- src/basemath/alglin1.c 1999/09/15 10:49:46
***************
*** 1944,1950 ****
ck = (GEN*)a[k]; m = (GEN)ck[i];
if (gcmp0(m))
{
! if (!gcmp1(p))
for (j=i+1; j<=nbco; j++)
{
p1 = gmul(p,ck[j]);
--- 1944,1955 ----
ck = (GEN*)a[k]; m = (GEN)ck[i];
if (gcmp0(m))
{
! if (gcmp1(p))
! {
! if (!gcmp1(pprec))
! a[k] = (long)gdivexact((GEN)a[k], pprec);
! }
! else
for (j=i+1; j<=nbco; j++)
{
p1 = gmul(p,ck[j]);
__
Karim Belabas email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France) Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://hasse.mathematik.tu-muenchen.de/ntsw/pari/