Bill Allombert on Thu, 17 Apr 2003 18:14:10 +0200


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

Re: point notation


On Thu, Apr 17, 2003 at 03:54:14PM +0200, Karim BELABAS wrote:
> On 17 Apr 2003, Markus Endres wrote:
> > I'm going to write a routine called GrInit which initialize a group ring
> > K[G] (like nfinit or bnfinit) in some way, returns something like the
> > wedderburn decomposition, K-irreducible characters, the maximal order
> > and something more.
> >
> > now, I want to use the point notation as in nfinit/bnfinit. that means,
> > I want a possibility to call my results like K.disc in K=nfinit(pol), as
> > example: KG=GrInit(...); KG.Kchi; which returns the characters
> >
> > This point notation would be very useful for me. Is there any
> > possibility to write such a 'point notation' by my own?
> 
> (11:25) gp > x.Kchi = x[2] \\ definition
> (11:25) gp > [1,2,3].Kchi
> %1 = 2
> 
> It's paragraph 2.6.4 in User's manual (stable branch. It's 2.6.5 in CVS).
> 
> See my "Contributed GP scripts" page for some examples, especially
> 
>   http://www.math.u-psud.fr/~belabas/pari/scripts/modsym.gp

There are two limitations however:

1) You cannot overload existing member functions, e.g. you cannot
extend .disc to work with your own type.

2) You cannot add member functions written in C to GP without changing
the interpretor. Instead you can do:
install("m_Kchi","G",,"./func.so");
x.Kchi=m_Kchi(x);
but it is not clean nor efficient (but I will probably add it to GP2C).

Cheers,
Bill.