> < ^ Date: Thu, 09 Dec 1993 22:06:23 -0800
> < ^ From: Jacob Hirbawi <hirbawi@commquest.com >
> ^ Subject: Efficiently locating records in lists

<gap-forum@samson.math.rwth-aachen.de>

I'm writing some gap code to work with representations of simple Lie algebras.
Although I'm already very pleased with the performance, (the gap version is
more than 10 times faster than a Mathematica version!); I am finding that no
less than half of the time (according to "Profile") is spent looking up the
position of elements in lists -- using "Position" or "PositionProperty",... .
Now the next set of calculations involves even more of this type of operation.
So I would like any pointers on how to improve the efficiency of locating
elemets in list.

Here's are some sample calculations

gap> B4 := WeylModule( Sb(4) );
rec(NumberOfPositiveRoots := 16,
    HighestRoot := [ 2, 2, 2, 1 ],
    CoxeterNumber := 7,
    Rho := [ 4, 7, 9, 5 ],
    AdjointRep := [ 2, 0, 0, 0 ],
    SimpleDimensions := [ 8, 27, 48, 42 ],
    Killing := function ( vec1, vec2 ) ... end,
    Dimension := function ( rep ) ... end,
    Weights := function ( rep ) ... end )

I think the above part of the calculations is fairly efficient although
the "Weights" function can greatly benefit from efficiently locating
elements in lists.

gap> w1 := B4.Weights([1,0,0,0]);
[ rec(weights := [ 1, 0, 0, 0 ],multiplicity := 1 ),
  rec(weights := [ -1, 1, 0, 0 ],multiplicity := 1 ),
  rec(weights := [ 0, -1, 1, 0 ],multiplicity := 1 ),
  rec(weights := [ 0, 0, -1, 1 ],multiplicity := 1 ),
  rec(weights := [ 0, 0, 1, -1 ],multiplicity := 1 ),
  rec(weights := [ 0, 1, -1, 0 ],multiplicity := 1 ),
  rec(weights := [ 1, -1, 0, 0 ],multiplicity := 1 ),
  rec(weights := [ -1, 0, 0, 0 ],multiplicity := 1 ) ]

This is the type of structure that the next set of routines will be
dealing with. Omitting the details, such records are manipulated by
comparing the weight components and accordingly change the multiplicity
part. In some sense this is similar to polynomial operations or those
of vector spaces, so perhaps some of the existing routines that deal
with these two can be modified for what I'm doing.

Thanks for any suggestions.

Jacob Hirbawi
JcbHrb@CERF.net


> < [top]