-
Notifications
You must be signed in to change notification settings - Fork 36
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
Document the limits of bipartitions #296
Conversation
ChristopherRussell
commented
May 31, 2017
•
edited by james-d-mitchell
Loading
edited by james-d-mitchell
- 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.
gap/elements/bipart.gi
Outdated
@@ -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 |
There was a problem hiding this comment.
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 ^
.
gap/elements/bipart.gi
Outdated
@@ -93,6 +93,14 @@ InstallGlobalFunction(Bipartition, | |||
function(classes) | |||
local n, copy, i, j; | |||
|
|||
n := Sum(List(classes, Length)) / 2; |
There was a problem hiding this comment.
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?
6756ee5
to
c892353
Compare
There was a problem hiding this 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. |
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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.
gap/elements/bipart.gi
Outdated
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,"); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
tst/standard/bipart.tst
Outdated
@@ -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, |
There was a problem hiding this comment.
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.
gap/elements/bipart.gi
Outdated
@@ -93,6 +93,14 @@ InstallGlobalFunction(Bipartition, | |||
function(classes) | |||
local n, copy, i, j; | |||
|
|||
n := Sum(classes, Length) / 2; |
There was a problem hiding this comment.
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.
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. |
I wonder if this is now resolved by the resolution of #444, I'll run travis again and see what happens. |
No wait, it'll first need to be rebased. @ChristopherRussell can you please rebase this onto |
tst/standard/bipart.tst
Outdated
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, |
There was a problem hiding this comment.
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.
gap/elements/bipart.gi
Outdated
if n >= 2 ^ 32 then | ||
ErrorNoReturn("Semigroups: BipartitionByIntRep: usage,\n", | ||
"the length of the argument <blocks> must not exceed", | ||
"2 ^ 32 - 1,"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space.
Did you rebase this already @ChristopherRussell ? I can't tell, so please comment when you have done it. |
8a27151
to
91b80ae
Compare
I have just rebased it (and included the extra space in the error output / test output which you recently suggested) |
@james-d-mitchell Travis 32-bit build is giving the following error:
where
This doesn't occur on my computer, any ideas what the difference is with the 32-bit mode? |
I think I know the reason, I'll try to fix it now. |
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. |
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 |
src/.clang-format
Outdated
@@ -1,11 +1,10 @@ | |||
--- |
There was a problem hiding this comment.
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.
I think I did make a mistake when trying to update my local version of stable-3.0 before rebasing |
This is currently a PR against |
91b80ae
to
7d985bf
Compare
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:
where elts is
and this doesn't seem to be resolved by the fix to Issue #444 as @james-d-mitchell suggested. |
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
I'm going to close this in favour of PR #472. |
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
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
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