Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add flat sparse packs #877
Add flat sparse packs #877
Changes from 5 commits
35a8b43
183e891
426effb
6a1ad2e
c7a5888
26299ba
7b9f2e4
ab4287d
debfb7a
4354c8b
752b677
1ea8f5d
13979aa
e7d4526
a9d8fdb
f611cc3
8640446
90fc737
85296f5
0a7c198
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Are they not valid if
b==0
? I thought they were.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.
Ok, after reading below I see they are not valid. I think we should make it so that they are valid, and maybe add a default
const int b=0
here so thatGetLowerBound()
andGetUpperBound()
work for sparse packs (or maybe make them separate functions that have a check ifflat_==true
). I think this is clearer than exposing the pack size throughGetMaxNumberOfVars()
.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.
Maybe better to just call them
GetFlatLowerBound()
andGetFlatUpperBound()
.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'm going to make them valid and just re-use the API. I'm not sure if we should come up with new or more generic names, I just chose not to for now. We can revisit that later maybe.
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.
Can't we still set this with the actual block index, i.e.
pack.bounds_h_(0, block, i) = idx
? I am not sure what the use case would be, but it would allow all of theGet*Bound
stuff to work returning the flat index.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.
Is this actually desired behaviour though? I wonder if
GetBounds
should return 0, and nvars always in the flat case? I could add an if statement to that effect maybe?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.
Now updated
GetLowerBound
returns 0 andGetUpperBound
returns total numbers of vars and blocks (i.e., pack size) for flat packs.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.