[GAP Forum] which function of dictionary can use polynomial or function as key, how many memory

Alexander Hulpke hulpke at math.colostate.edu
Thu Sep 25 15:52:48 BST 2014


Dear Lee Martin,

[I suggest that further discussion on these issues is not sent to the forum@, mail address, which copies to hundreds of subscribers, but to support@]

> How to edit the value of dictionary?
> How to append a function to a list which is a value of dictionary?

The values of a dictionary are immutable and cannot be changed (cleanly), so this is not possible.

Concerning the memory problems you reported, did you by any chance get the error message:
exceeded the permitted memory (`-o' command line option)

If so, you can find a description under

http://mail.gap-system.org/pipermail/forum/2010/002986.html

Regards,

   Alexander Hulpke


> 
> Regards,
> 
> Martin
> 
> > Subject: Re: [GAP Forum] which function of dictionary can use polynomial or function as key
> > From: hulpke at math.colostate.edu
> > Date: Wed, 24 Sep 2014 09:27:04 -0600
> > CC: forum at gap-system.org
> > To: tesleft at hotmail.com
> > 
> > Dear Forum,
> > 
> > On Sep 24, 2014, at 9/24/14 3:21, Lee Martin CCNP <tesleft at hotmail.com> 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
> > > Forum at mail.gap-system.org
> > > http://mail.gap-system.org/mailman/listinfo/forum
> > 




More information about the Forum mailing list