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

Fix rounding inequalities and allow Makefile to choose between python and python3 #9

Merged
merged 2 commits into from
Sep 27, 2023

Conversation

MaxleDrut
Copy link

@MaxleDrut MaxleDrut commented Sep 27, 2023

Some machines including mine were having float rounding issues when translating some gates (the state phase was equal to 1 + 1e-18j which was not equal to 1)

This PR replaces the array_equal function by allclose, using the default thresholds to ensure this comparison will work even with float issues. It also improves the Makefile to detect if python3 is an available command on the users machine to use it instead.

Safe to revert.

@MaxleDrut MaxleDrut requested a review from jrj-d September 27, 2023 09:03
@MaxleDrut MaxleDrut changed the title Fix: prevent rounding inequalities with close instead of equal Fix rounding inequalities and allow Makefile to choose between python and python3 Sep 27, 2023
@MaxleDrut MaxleDrut force-pushed the mdrutel-fix-array-equal-rounding-unequalities branch 3 times, most recently from 4ad5ac9 to ce74263 Compare September 27, 2023 09:45
@MaxleDrut MaxleDrut force-pushed the mdrutel-fix-array-equal-rounding-unequalities branch from ce74263 to 5c6fcab Compare September 27, 2023 09:51
Makefile Show resolved Hide resolved
@MaxleDrut
Copy link
Author

MaxleDrut commented Sep 27, 2023

Seen IRL and did further tests. I ensured python was referring to version 3 and replaced our check of python3 by some gibberish (to be sure it wouldn't return anything).

The Makefile hence used python in its further calls, looks good to me!

@MaxleDrut MaxleDrut merged commit 5248fad into main Sep 27, 2023
14 checks passed
@MaxleDrut MaxleDrut deleted the mdrutel-fix-array-equal-rounding-unequalities branch September 27, 2023 15:01
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