Switch the sign around on compare_QEntry. #117
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.
What's this for?
At the moment, the BDGL sieve's
compare_QEntrycode looks like this:g6k/kernel/bdgl_sieve.cpp
Line 51 in 72a5c04
This seems to be the wrong way around: as written, it'll sort the queue into descending order, rather than ascending. For example, cppreference has this to say about the comparator function:
I think this is the wrong way around for what the BDGL code is supposed to do. Indeed, it looks like the assumption is that the queue is sorted in ascending order. For example, the
bdgl_queue_create_taskfunction looks like it wants to prioritise inserting shorter vectors, rather than longer ones.This PR also seems to improve performance (admittedly in low dimensions) compared to the old version. For example, in dimension 90 I get an average reduction in wall time of around 15%, and the same is true for the CPU time. Whilst this might not hold in larger dimensions, it still seems to be a worthwhile change.
New timings:
Old timings:
Of course, all of this assumes that my interpretation of what the code should do is correct.