Karim BELABAS on Thu, 20 Mar 2003 22:38:41 +0100 (MET) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Bug |
On Thu, 20 Mar 2003, Bill Allombert wrote: > On Thu, Mar 20, 2003 at 06:06:35PM -0000, Jon Perry wrote: >> { >> dispfact(n)=local(k,kl,v); >> k=factor(n);kl=length(k[,2]); >> v=vector(kl); >> for (i=1,kl,v[i]=concat(concat(k[,1][i],"^"),k[,2][i])); >> v >> } >> >> Using Pari2.2.5 for Windows, as complied by David Cleaver, the above code >> doesn't work (it works in Pari2.1.3) >> >> Trying dispfact(12345), where k is length 3, apparently i=3 is too much. > > Well I confirm this bug with the CVS version on Linux: > ? factor(12345)[,1][3] > *** array index (3) out of allowed range [1-2]: factor(12345)[,1][3] > ^-- > > Note that you can get around the problem by rewriting it as > for (i=1,kl,v[i]=concat(concat(k[i,1],"^"),k[i,2])); or in fact Str(k[i,1], "^", k[i,2]) [ in 2.2.5 and onward ] > which is cleaner anyway. It was a typo in some code of mine, supposedly doing exactly the above automatically: 'collapse [,c][r] into [r,c]' reads the comment. Fixed in CVS. Karim. -- Karim Belabas Tel: (+33) (0)1 69 15 57 48 Dép. de Mathématiques, Bât. 425 Fax: (+33) (0)1 69 15 60 19 Université Paris-Sud http://www.math.u-psud.fr/~belabas/ F-91405 Orsay (France) http://www.parigp-home.de/ [PARI/GP]