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

Document the limits of bipartitions #296

Closed

Conversation

ChristopherRussell
Copy link
Collaborator

@ChristopherRussell ChristopherRussell commented May 31, 2017

  • Added two sentences to the doc explaining that bipartitions are capped at degree 2 ^ 31 yet are unlikely to work (due to memory constraints) for even smaller degrees.
  • Added errors for methods within bipart.gi which bipartitions. These occur detect when the user attempts to create a bipartition of degree greater than or equal to 2 ^ 31.
  • Covered these new error messages with new tests.

@@ -241,6 +262,11 @@ InstallMethod(RandomBlockBijection, "for a random source and pos int",
function(rs, n)
local out, nrblocks, j, free, i;

if n >= 2^31 then
Copy link
Collaborator

Choose a reason for hiding this comment

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

The linter will complain about this - put whitespace around ^.

@@ -93,6 +93,14 @@ InstallGlobalFunction(Bipartition,
function(classes)
local n, copy, i, j;

n := Sum(List(classes, Length)) / 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

In fact, Sum(List(classes, Length)) can be replaced by simply Sum(classes, Length). I believe the same goes for Product. Handy, eh?

@mtorpey mtorpey added the 3.0 label May 31, 2017
@ChristopherRussell ChristopherRussell force-pushed the bipartdoc branch 5 times, most recently from 6756ee5 to c892353 Compare May 31, 2017 14:28
Copy link
Collaborator

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

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

Looks pretty good, few minor changes and we'll merge it.

doc/z-chap03.xml Outdated
described in this section.
described in this section. The maximum degree of a bipartition is set as
2 ^ 31. In reality, bipartitions of degrees as small as 2 ^ 24 are unlikely
to work because they require too much memory.
Copy link
Collaborator

Choose a reason for hiding this comment

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

"In reality, it is unlikely to be possible to create bipartitions of degrees as small as 2 ^ 24 because they require too much memory."

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also it seems that you limit this to 2 ^ 31 - 1 so this comment is not very accurate.

if n >= 2 ^ 31 then
ErrorNoReturn("Semigroups: Bipartition: usage,\n",
"the argument <classes> must be a list of lists whose union",
"has length at most 2 ^ 31 - 1,");
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this be "consists of values in the range 1 to 2 ^ 31 - 1"? Since if it is a list of length 10 containing numbers in excess of 2 ^ 31 - 1, then it will not work.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I that think the function takes a list of lists as its argument and the degree is half the length of the union of the lists.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but as you've written it the numbers in the lists can be arbitrarily big as long as there are less than 2 ^ 31 - 1 of them.

@@ -484,8 +484,8 @@ gap> RightProjection(StarOp(x));

# bipartition: Bipartition 1/3
gap> Bipartition("test");
Error, Semigroups: Bipartition: usage,
the argument <classes> must consist of duplicate-free homogeneous lists,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the changes in this pull request turn an informative error (the previous one) into an uninformative error (the current one). Please revert this.

@@ -93,6 +93,14 @@ InstallGlobalFunction(Bipartition,
function(classes)
local n, copy, i, j;

n := Sum(classes, Length) / 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can't go here, since you do not yet know that classes consists of lists.

@wilfwilson wilfwilson changed the title Limits of Bipartitions Document the limits of bipartitions May 31, 2017
@mtorpey mtorpey added 3.1 and removed 3.0 labels Jun 2, 2017
@mtorpey
Copy link
Collaborator

mtorpey commented Jun 2, 2017

32-bit tests are failing - we have no idea why, but it's something in the very first commit in this PR.

Looks like something weird.

We'll fix this later.

@mtorpey mtorpey added the do not merge Label for PR that should not be merged label Jun 14, 2017
@james-d-mitchell
Copy link
Collaborator

I wonder if this is now resolved by the resolution of #444, I'll run travis again and see what happens.

@james-d-mitchell
Copy link
Collaborator

james-d-mitchell commented Mar 27, 2018

No wait, it'll first need to be rebased. @ChristopherRussell can you please rebase this onto stable-3.0? If this still fails, then I guess the reason is that we somehow create a too long list in 32-bit mode in the kernel module.

@james-d-mitchell james-d-mitchell added bug Label for issues or PR which report or fix bugs 3.0 and removed 3.1 labels Mar 27, 2018
Error, Semigroups: Bipartition: usage,
the argument <classes> must be a list of lists whose unionhas length at most 2\
^ 31 - 1,
gap> BipartitionByIntRep([1 .. 2 ^ 32]);
gap> BipartitionByIntRep(enum);
Error, Semigroups: BipartitionByIntRep: usage,
the length of the argument <blocks> must not exceed2 ^ 32 - 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems to be a space missing in the error message here.

if n >= 2 ^ 32 then
ErrorNoReturn("Semigroups: BipartitionByIntRep: usage,\n",
"the length of the argument <blocks> must not exceed",
"2 ^ 32 - 1,");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing space.

@james-d-mitchell
Copy link
Collaborator

Did you rebase this already @ChristopherRussell ? I can't tell, so please comment when you have done it.

@ChristopherRussell ChristopherRussell force-pushed the bipartdoc branch 2 times, most recently from 8a27151 to 91b80ae Compare April 3, 2018 09:58
@ChristopherRussell
Copy link
Collaborator Author

ChristopherRussell commented Apr 3, 2018

I have just rebased it (and included the extra space in the error output / test output which you recently suggested)

@ChristopherRussell
Copy link
Collaborator Author

ChristopherRussell commented Apr 3, 2018

@james-d-mitchell Travis 32-bit build is giving the following error:

testing: /home/travis/gap/pkg/semigroups/tst/standard/bipart.tst
######## > Diff in:
/home/travis/gap/pkg/semigroups/tst/standard/bipart.tst:107
# Input is:
ForAll(elts, x -> AsBipartition(AsPartialPerm(x), 3) = x);
# Expected output:
true
# But found:
false
########

where elts is

elts := Filtered(PartitionMonoid(3), IsPartialPermBipartition);;

This doesn't occur on my computer, any ideas what the difference is with the 32-bit mode?

@james-d-mitchell
Copy link
Collaborator

I think I know the reason, I'll try to fix it now.

@james-d-mitchell
Copy link
Collaborator

Actually, maybe not. Just to double check @ChristopherRussell are you sure that you pulled from the master branch before rebasing? I ask because the 32-bit tests also include a "function must return a value" error, which is the same error as in Issue #444, which was caused by a (now resolved) bug in the bipartitions code.

@james-d-mitchell
Copy link
Collaborator

james-d-mitchell commented Apr 3, 2018

Looking at the diff in the files, you may have rebased this on the current master branch, but there are changes to some files which I don't think should be there, such as in .clang-format, bipart.cc, and so on. Can you please undo the changes to those files which are formatting/whitespace changes only?
@ChristopherRussell

@@ -1,11 +1,10 @@
---
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not commit any changes to this file.

@ChristopherRussell
Copy link
Collaborator Author

I think I did make a mistake when trying to update my local version of stable-3.0 before rebasing

@wilfwilson
Copy link
Collaborator

wilfwilson commented Apr 3, 2018

This is currently a PR against master, but shouldn't it be against stable-3.0? Chris's branch is based on stable-3.0.

@ChristopherRussell ChristopherRussell changed the base branch from master to stable-3.0 April 3, 2018 11:43
@ChristopherRussell
Copy link
Collaborator Author

ChristopherRussell commented Apr 3, 2018

As Wilf said I was rebasing against master when I meant to rebase against stable-3.0 which cased the changes to kernel code. However, there is still error in the 32-bit build tests:

testing: /home/travis/gap/pkg/semigroups/tst/standard/bipart.tst
######## > Diff in:
/home/travis/gap/pkg/semigroups/tst/standard/bipart.tst:107
# Input is:
ForAll(elts, x -> AsBipartition(AsPartialPerm(x), 3) = x);
# Expected output:
true
# But found:
false
########

where elts is

elts := Filtered(PartitionMonoid(3), IsPartialPermBipartition);;

and this doesn't seem to be resolved by the fix to Issue #444 as @james-d-mitchell suggested.

@james-d-mitchell james-d-mitchell removed the bug Label for issues or PR which report or fix bugs label Apr 3, 2018
james-d-mitchell pushed a commit to james-d-mitchell/gap that referenced this pull request Apr 5, 2018
This occasionally caused incorrect values to be returned when i == deg
and by coincidence ptf2[i] == cpt. When ptf2[deg] is beyond the end of
the bag containing f, and so is not valid. For reference, this bug
caused errors in:

semigroups/Semigroups#296
semigroups/Semigroups#472
@james-d-mitchell
Copy link
Collaborator

I'm going to close this in favour of PR #472.

james-d-mitchell pushed a commit to james-d-mitchell/gap that referenced this pull request Apr 6, 2018
This occasionally caused incorrect values to be returned when i == deg
and by coincidence ptf2[i] == cpt. When ptf2[deg] is beyond the end of
the bag containing f, and so is not valid. For reference, this bug
caused errors in:

semigroups/Semigroups#296
semigroups/Semigroups#472
fingolfin pushed a commit to gap-system/gap that referenced this pull request Apr 6, 2018
This occasionally caused incorrect values to be returned when i == deg
and by coincidence ptf2[i] == cpt. When ptf2[deg] is beyond the end of
the bag containing f, and so is not valid. For reference, this bug
caused errors in:

semigroups/Semigroups#296
semigroups/Semigroups#472
ChrisJefferson pushed a commit to ChrisJefferson/gap that referenced this pull request Jun 14, 2018
This occasionally caused incorrect values to be returned when i == deg
and by coincidence ptf2[i] == cpt. When ptf2[deg] is beyond the end of
the bag containing f, and so is not valid. For reference, this bug
caused errors in:

semigroups/Semigroups#296
semigroups/Semigroups#472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge Label for PR that should not be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants