[GAP Forum] Tuple attribute
Alexander Hulpke
hulpke at math.colostate.edu
Wed Dec 31 00:07:49 GMT 2003
Dear GAP Forum,
Jose Morais asked:
> I have defined an attribute (SemiDirectProductElmAction) for certain
>tuples (elements of a semidirect product semigroup being constructed)
>because I need to know this attribute to multiply elements of this new
>semigroup, but it is not stored when I do
Attributes are only stored if the representation is in
`IsAttributeStoringRep'. Tuples are not in this representation and thus do
not store attributes (which is the behaviour you observed).
To get around the problem there are two ways: the first is to create your
own tuples that use the `ComponentObject' representation and thus are able
to store attributes. In your case however this looks like overkill.
What I would do instead (and is the way similar situations are dealt with in
the library) is to declare the attribute for the *family* of tuples (which
is by default attribute storing):
DeclareAttribute("MyAttribute",IsFamily);
and set this attribute once you create your initial objects:
...
# create generating tuples
tups:=....
fam:=FamilyObj(tups[1]);
SetMyAttribute(fam,actioninfo);
In your multiplication routine (when you need the attribute value) you can
then get it from the family:
MyMultiplication:=function(a,b)
local actioninfo;
actioninfo:=MyAttribute(FamilyObj(a));
Setter(SemiDirectProductElmAction)(t, act);
(You can see examples of such code in the library file `gprd.gi' that
implements generic products for groups.)
Best wishes and a Happy New Year,
Alexander Hulpke
-- Colorado State University, Department of Mathematics,
Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
email: hulpke at math.colostate.edu, Phone: ++1-970-4914288
http://www.math.colostate.edu/~hulpke
More information about the Forum
mailing list