Dear Forum,

On Sep 24, 2014, at 9/24/14 3:21, Lee Martin CCNP <[email protected]> wrote:

> would like to use rational function as key in dictionary like table function 
> in maple
> which function is a dictionary can use function as key and value as list to 
> store ideals.

Lookup dictionaries currently work with rational functions, e.g:

gap> R:=PolynomialRing(Rationals,["x","y","z"]);AssignGeneratorVariables(R);   
Rationals[x,y,z]
#I  Assigned the global variables [ x, y, z ]

gap> d:=NewDictionary(x,true);
<object>
gap> AddDictionary(d,x,1);
gap> AddDictionary(d,y,2);
gap> LookupDictionary(d,x);
1
gap> LookupDictionary(d,z);
fail
gap> AddDictionary(d,x/y,2);
gap> LookupDictionary(d,z);
fail
gap> LookupDictionary(d,x/y);
2

Instead of numbers you should be able to store arbitrary associated 
information. However internally lists will be made immutable, so if your ideal 
list is expected to grow you would need to keep a separate (mutable) list of 
the ideal lists, storing only an index in the dictionary.

I note that

gap> RepresentationsOfObject(d);
[ "IsComponentObjectRep", "IsDictionaryDefaultRep", "IsListDictionary", 
  "IsListLookupDictionary", "IsSortDictionary", "IsSortLookupDictionary" ]

this currently uses sorted lists internally and not yet hashing. To enable 
hashing, one would have to add a method for SparseHashKey for rational 
functions, which currently is not on the list of features.

Best,

   Alexander Hulpke


> Regards,
> Martin                                          
> _______________________________________________
> Forum mailing list
> [email protected]
> http://mail.gap-system.org/mailman/listinfo/forum


_______________________________________________
Forum mailing list
[email protected]
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to