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

New tests for group constructors and some fixes #1053

Merged
merged 14 commits into from
Jan 13, 2017

Conversation

fingolfin
Copy link
Member

@fingolfin fingolfin commented Jan 7, 2017

  • add a bunch of tests for group constructors in the grp directory
  • add tests for for various matrix groups that verify the given invariant forms
  • fix GO(1,4,5) (triggers an error on master)
  • add invariant forms for Sp(2*n, Integers mod 2^k)
  • remove cache limit from perfect groups library, to increase speed
  • remove some invalid (and unusable) constructor variants
  • tweak error messages in some group constructors

@codecov-io
Copy link

codecov-io commented Jan 7, 2017

Current coverage is 53.97% (diff: 100%)

No coverage report found for master at 34e30fb.

Powered by Codecov. Last update 34e30fb...3a85e11

@ChrisJefferson
Copy link
Contributor

These all look good and uncontroversial. Will merge unless someone says something in the next couple of days.

It is annoying it looks like coverage got worse, as tst files aren't marked as covered I think.

@fingolfin
Copy link
Member Author

Ahhhh, is that why? hmmm, so how are the total lines reported to / computed by codecov? I would havethought it only counts source files in lib, src, ... as shown on their website...

@fingolfin
Copy link
Member Author

I think the tes files are not the reason for this change. Rather, what really happened is that codecov ignores files which have neither hits nor misses. With this PR, it soundly "learned" about some additional source files (several perf*.grp files) which are not covered.

@fingolfin
Copy link
Member Author

Something weird is going on: I added a brutal test which invokes PerfectGroup for every legal input. So it should in theory show 100% coverage for all the perfNN.grp files. Yet it doesn't, it even reports 0% coverage for some of them. Huh?

@ChrisJefferson any idea what might be going wrong here?

These error message (and also those for the classical groups)
seem to vary quite a bit. We may want to unify them at some point.
For some strange reasons, many group constructor wrapper allow the user
to pass one more argument than documented. I could not find any methods
supporting these extra arguments. Looking at the old repository, these
extra calls already appear in the first GAP4 version of this code, added
by Frank Celler 1997-01-15. So I think it's either a copy&paste mistake,
or a remnant of GAP3.
@ChrisJefferson
Copy link
Contributor

Good question -- not sure.

If I manually run PerfectGroup(7800), then I get coverage of the first part of perf2.grp, so it's some combination of the tests being run, and the information going to testcov I think. For some reason, I'm having trouble checking out your branch for some reason to try it out.

@ChrisJefferson
Copy link
Contributor

Nope, it is my fault, something weird is going on (your tests lead to weirdly corrupted profiling output. I think it's because the files keep getting re-read. Investigating).

@ChrisJefferson
Copy link
Contributor

Turns out profiling breaks with re-reading of files! Will looking into fixing that.

Independently, the Perfect Groups library only keeps a cache of 50 groups (if I'm reading it right), perf.grp, line 31. If I push that to 1000, then perf.grp goes from 2.7 sec to 0.5 sec.

@fingolfin
Copy link
Member Author

fingolfin commented Jan 8, 2017

Nice catch about that cache. In fact, there are only 331 entries, so setting this to 1000 just caches everything.

I just checked: a fully loaded PERFGRP is about 4.6 MB (though this is without my MemoryUsage fixes...). I think we should just remove the caching logic. And perhaps in the future revise it, once we got around to adding a proper generic "cache" system (possibly using weak pointers and stuff....) which we need for the HPC-GAP integration anyway.

The whole data is only about 4.5 MB in RAM. The implemented caching
logic was not very clever either (e.g. not using a "last recently used"
approach, but rather always throwing away the first 25 loaded PERFGRP
entries).
@ChrisJefferson
Copy link
Contributor

Coverage looks much better now -- no idea why one tiny bit of perf1.grp isn't covered... could you have a look and see if you think it's a profiling problem, or a GAP problem?

@fingolfin
Copy link
Member Author

The unused code in perf1.grp really is not called, and there is a comment next to it which says # 1920.8 (otherpres.). I will investigate (just got the book by Plesken & Holt on my desktop)

@fingolfin
Copy link
Member Author

Actually, there are a bunch of these entries with an "otherpres." comment next to them. The indices of these entries are always higher than the number of perfect groups of that order, so presumably we are looking at alternative presentations for some groups (but which?). So the real weird part is that some of them are used after all... indirectly. E.g. 1080.2 is used by PerfectGroup(69120,1).

I am not sure why 1920.8, 1344.3 and 1344.4 are there but not used. I could not yet identify their source in Holt/Plesken (but I only skimmed and didn't try hard, so it might be in there). Anyway, it seems harmless.

@fingolfin fingolfin changed the title Some new test for group constructors New tests for group constructors and some fixes Jan 9, 2017
@fingolfin
Copy link
Member Author

I think this is good now. Overall coverage is up by 3.55% and the grp dir has 90% coverage :-). Of course this makes it look at bit better than it is: There certainly could be more comprhensive checks. E.g. one could check whether the pre-computed group sizes and other properties are correct (by doing something like H:=Group(GeneratorsOfGroup(G));; Size(G)=Size(H);), check other group properties, etc. But it's a start.

Copy link
Contributor

@ChrisJefferson ChrisJefferson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, with two small comments.

@@ -403,7 +403,7 @@ BindGlobal( "Oplus45", function()

# construct the group without calling 'Group'
g := [ phi*tau2, tau*eichler*delta ];
g:=List(g,i->ImmutableMatrix(f,i),true);
g:=List(g,i->ImmutableMatrix(f,i));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this code ever work, out of interest? What's that true supposed to do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it worked until 814a0f6 broke it by making List validate its arguments more agressively. My guess is that the true in there was an accident.

g := Group(slmats);
mat := Concatenation(id{[nh+1..n]},-id{[1..nh]});
SetInvariantBilinearForm(g,rec(matrix:=mat));
return g;
end);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to trust this is right.. I assume these is a test for it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes -- indeed, writing the tests for Sp(2*n, Integers mod p^k) lead me to discover that the invariant form was missing for p=2, and hence I added this to make the tests pass. so this was TDD (test driven development) :-).

Copy link
Contributor

@ChrisJefferson ChrisJefferson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now approved

@fingolfin
Copy link
Member Author

So, merge this? Rebase it? Should I do it myself?

@ChrisJefferson ChrisJefferson merged commit 9fffac5 into gap-system:master Jan 13, 2017
@fingolfin fingolfin deleted the mh/coverage branch January 25, 2017 13:44
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.9.0 milestone Jan 29, 2018
@olexandr-konovalov olexandr-konovalov added the release notes: added PRs introducing changes that have since been mentioned in the release notes label Jan 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants