-
Notifications
You must be signed in to change notification settings - Fork 56
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
Using quad #201
Using quad #201
Conversation
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.
Awesome! Does anything in _hafnian.py
need to be updated to take this into account?
@@ -171,14 +171,14 @@ inline T do_chunk_loops(std::vector<T> &mat, std::vector<T> &C, std::vector<T> & | |||
comb[0] = 1.0; | |||
|
|||
for (i = 1; i <= n / 2; i++) { | |||
factor = traces[i - 1] / (2.0 * i); | |||
factor = traces[i - 1] / static_cast<T> (2.0 * i); |
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.
Has the file been run through astyle? I just noticed that this casting looks like static_cast<t> ()
but the one above has different formatting static_cast<T>()
.
* In addition, this wrapper function automatically casts all matrices | ||
* to type `complex<long double>`, allowing for greater precision than supported | ||
* by Python and NumPy. |
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.
💯
@@ -318,7 +318,7 @@ void apply_householder(std::vector<T> &A, std::vector<T> &v, size_t size_A, | |||
size_t sizeH = v.size(); | |||
|
|||
auto norm_v_sqr = norm_sqr(v); | |||
if (norm_v_sqr == 0.) | |||
if (norm_v_sqr == static_cast<T>(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.
(same here re: different formatting)
* Add power trace optimization conforming to c++11 * include type_traits in the hope it solves MSVC prob * Fix typo * Apply astyle to eigenvalue_hafnian.hpp * Update include/eigenvalue_hafnian.hpp * Removes whitespaces * Using quad (#201) * First attempt. Failed * It works! * Fixes conversion issues * updates docstring * updates changelog * First attempt at MSVC2017 (#202) * Apply suggestions from code review * add docs * lower sphinx version * Update setup.py Co-authored-by: Nicolas Quesada <zeitus@gmail.com> Co-authored-by: Josh Izaac <josh146@gmail.com>
* Add power trace optimization conforming to c++11 * include type_traits in the hope it solves MSVC prob * Fix typo * Apply astyle to eigenvalue_hafnian.hpp * Update include/eigenvalue_hafnian.hpp * Removes whitespaces * Using quad (#201) * First attempt. Failed * It works! * Fixes conversion issues * updates docstring * updates changelog * First attempt at MSVC2017 (#202) * Apply suggestions from code review * Adds C++ branching for loop hafnians in quad of odd size * Update setup.py * Adds tests for missing functality * Adds tests for missing functionality Co-authored-by: Trevor Vincent <tvincent@cita.utoronto.ca> Co-authored-by: Trevor Vincent <trevor-vincent@users.noreply.github.com> Co-authored-by: Josh Izaac <josh146@gmail.com>
Exposes the new functions to the python library, by creating specific functions for converting double into quad, do the calculations in quad and then return a double.