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

Using quad #201

Merged
merged 4 commits into from
Sep 30, 2020
Merged

Using quad #201

merged 4 commits into from
Sep 30, 2020

Conversation

nquesada
Copy link
Collaborator

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.

@nquesada nquesada requested review from trevor-vincent and josh146 and removed request for trevor-vincent September 30, 2020 15:11
Copy link
Member

@josh146 josh146 left a 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);
Copy link
Member

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>().

Comment on lines +446 to +448
* In addition, this wrapper function automatically casts all matrices
* to type `complex<long double>`, allowing for greater precision than supported
* by Python and NumPy.
Copy link
Member

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.))
Copy link
Member

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)

@josh146 josh146 merged commit e0a7d06 into powtrace_opt_cp11 Sep 30, 2020
@josh146 josh146 deleted the using_quad branch September 30, 2020 16:25
trevor-vincent added a commit that referenced this pull request Oct 19, 2020
* 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>
thisac pushed a commit that referenced this pull request Oct 20, 2020
* 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>
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