Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MemoryUsage just returns a constant if the argument is a word #897

Closed
Stefan-Kohl opened this issue Sep 21, 2016 · 5 comments
Closed

MemoryUsage just returns a constant if the argument is a word #897

Stefan-Kohl opened this issue Sep 21, 2016 · 5 comments

Comments

@Stefan-Kohl
Copy link
Member

Observed behaviour

gap> F := FreeGroup(3);;
gap> w := One(F);;
gap> for i in [1..10000] do w := w * Random(GeneratorsOfGroup(F)); od;
gap> MemoryUsage(w);
40
gap> MemoryUsage(ExtRepOfObj(w));
120248

Expected behaviour

gap> F := FreeGroup(3);;
gap> w := One(F);;
gap> for i in [1..10000] do w := w * Random(GeneratorsOfGroup(F)); od;
gap> MemoryUsage(w); # approximately!
120248

Copy and paste GAP banner (to tell us about your setup)

┌───────┐ GAP 4.8.4, 04-Jun-2016, build of 2016-06-10 15:51:35 (CEST)
│ GAP │ http://www.gap-system.org
└───────┘ Architecture: x86_64-pc-linux-gnu-gcc-default64
Libs used: gmp, readline
Loading the library and packages ...
Components: trans 1.0, prim 2.1, small* 1.0, id* 1.0
Packages: GAPDoc 1.5.1

@ChrisJefferson
Copy link
Contributor

The problem is that the object isn't a IsPositionalObjectRep, but is really (the data is stored in ![1]). I'm not sure what exactly is going wrong, and where this should be fixed.

@frankluebeck
Copy link
Member

According to section ?NewRepresentation it seems to be a bug that the representation IsBLetterAssocWordRep is not a subrepresentation of IsPositionalObjectRep. After changing the declaration (in wordass.gd) to

DeclareRepresentation( "IsBLetterAssocWordRep", 
                        IsLetterAssocWordRep and IsPositionalObjectRep, [] );

MemoryUsage works as expected in the above example.

There are probably other similar bugs in that file. It would be good if someone could have a look who knows more about these various representations than me.

@stevelinton
Copy link
Contributor

We should be able to scan for representations that are not descended from IsInternalRep, IsPositionalObjectRep, IsComponentObjectRep or IsDataObjectRep.

@markuspf
Copy link
Member

We have:

  • IsSyllableAssocWordRep
  • IsLetterAssocWordRep
  • IsBLetterAssocWordRep
  • IsWLetterAssocWordRep
  • IsPermGroupGeneralMapping
  • IsSubgroupOfWholeGroupByQuotientRep
  • IsGenericCharacterTableRep
  • IsNullMapMatrix
  • IsDefaultGeneralMappingRep
  • IsInverseGeneralMappingRep
  • IsMemberPcSeriesPermGroup
  • IsSlicedPerm
  • IsSlicedPermInv
  • IsFromTheLeftCollectorRep
  • IsGroupClassByListRep
  • IsNilpotentLieAutomorphismRep

(Found by filtering AllRepresentations() by not having any of the four Reps above in their IMPL_FLAGS, AllRepresentations() being a function I just added to the library).

@fingolfin
Copy link
Member

Note: I removed my last two comments in favor of a separate issue (see #1043). Should have done that from the start. Sorry for the noise.

fingolfin added a commit to fingolfin/gap that referenced this issue Dec 28, 2016
fingolfin added a commit to fingolfin/gap that referenced this issue Dec 28, 2016
fingolfin added a commit to fingolfin/gap that referenced this issue Dec 28, 2016
fingolfin added a commit to fingolfin/gap that referenced this issue Dec 28, 2016
fingolfin added a commit to fingolfin/gap that referenced this issue Dec 29, 2016
fingolfin added a commit to fingolfin/gap that referenced this issue Dec 29, 2016
fingolfin added a commit to fingolfin/gap that referenced this issue Jan 5, 2017
fingolfin added a commit to fingolfin/gap that referenced this issue Jan 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants