-
Notifications
You must be signed in to change notification settings - Fork 81
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
C++ BQM.add_quadratic from COO #819
C++ BQM.add_quadratic from COO #819
Conversation
Codecov Report
@@ Coverage Diff @@
## main #819 +/- ##
=======================================
Coverage 92.50% 92.50%
=======================================
Files 63 63
Lines 4658 4658
=======================================
Hits 4309 4309
Misses 349 349 Continue to review full report at Codecov.
|
} else if (length < 0) { | ||
throw std::out_of_range("length must be positive"); | ||
} | ||
|
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.
Do you want to do an early exit if length == 0 ?
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 solution works for length==0
as-is and I don't think it's a case worth optimizing for.
|
||
std::int64_t pivot_choice_index = (low + high + 1) / 2; | ||
if (pivot_choice_index != high) { | ||
T2 response_temp = response[pivot_choice_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.
Sorry I may have not made my comment clear enough, we need to have the old code and the new code, that is whenever you swap the control you need to swap the response, I had been missing the response part.
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 is what I get for being lazy and not adding tests 😆 . Ok I will do it the right way...
/// Return the size of the neighborhood. | ||
size_type size() const { return neighbors.size(); } | ||
|
||
/// Sort the neighborhood and sum the biases of duplicate variables. | ||
void sort_and_sum() { |
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.
Do you want to move this i mean the part of code to do the sum only to the utils like the zip sort one ? Up to you.
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.
Eh, for now I'll leave it be and move it when it becomes relevant.
Co-authored-by: Anil Mahmud <amahmud@dwavesys.com>
69296d8
to
40bbe65
Compare
New Features ------------ * Support PEP518 for building the package #814 * Add `cyVariables.size()` and `.at(..)` to improve cython access to the `Variables` object * Add new `QuadraticModelBase` and `BinaryQuadraticModel` implementation in c++ #818, #819 Fixes ----- * Fix broken documentation links #815
No description provided.