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

Ensure that "true" and "false" won't go in same bucket in hash table #3471

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

d-torrance
Copy link
Member

@d-torrance d-torrance commented Sep 11, 2024

This doesn't completely address #3468, but it at least does when the keys of the hash table are true and false.

Before:

i2 : buckets tally {true, false}

o2 = {{}, {(false, 1), (true, 1)}, {}, {}}

o2 : List

After

i2 : buckets tally {true, false}

o2 = {{(false, 1)}, {(true, 1)}, {}, {}}

o2 : List

We also refactor the code mentioned in #3468 (comment) so it doesn't rely on the order of the elements returned by values. Edit: I removed this commit because it's already dealt with in #3469.

Edit no. 2: I adjusted the hash of false to be congruent to 2 (mod 4) instead of 0 (mod 4) so that the true bucket would go before the false bucket and the builds wouldn't fail w/o #3469.

@mahrud
Copy link
Member

mahrud commented Sep 11, 2024

What if we treated true and false as 0/1 like in C?

@d-torrance
Copy link
Member Author

Works for me!

@mahrud
Copy link
Member

mahrud commented Sep 11, 2024

I think just wait until the other one is merged first.

Previously, "hash true" and "hash false" were both congruent to 1 (mod
4).  We just set them to 1 and 0, resp.

Also update the corresponding basic test.
@d-torrance d-torrance merged commit 82a49a7 into Macaulay2:development Sep 12, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants