Karim Belabas on Tue, 03 Jan 2006 15:10:40 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: unpicking Mod


* Igor Schein [2005-12-28 16:46]:
> On Wed, Dec 28, 2005 at 12:50:20AM -0500, Mak Trifkovic wrote:
> > Say a=Mod(b,c).  Now I can retrieve b from a simply by b=lift(a).  But how 
> > do I get c?
> 
> component(a,1)

In the unstable branch, one should access an object components
via member functions, rather than by (memorizing and) assuming
a particular layout: try a.mod instead.

Besides, it's faster:

  (14:42) gp > for(i=1, 10^6, component(a,1))
  time = 582 ms.

  (14:42) gp > for(i=1, 10^6, a.mod)
  time = 327 ms.

Cheers (and a happy new year to all),

    Karim.
-- 
Karim Belabas                  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]