-
Notifications
You must be signed in to change notification settings - Fork 61
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
Update GST to take in gates.Unitary #1587
base: master
Are you sure you want to change the base?
Conversation
if isinstance(params, list): | ||
init_args = signature(gate).parameters | ||
valid_angles = [arg for arg in init_args if arg in angles] | ||
angle_values = dict(zip(valid_angles, params)) | ||
else: | ||
init_args = signature(gate).parameters | ||
valid_angles = [arg for arg in init_args if arg in matrix] | ||
angle_values = dict(zip(valid_angles, [params])) |
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.
if isinstance(params, list): | |
init_args = signature(gate).parameters | |
valid_angles = [arg for arg in init_args if arg in angles] | |
angle_values = dict(zip(valid_angles, params)) | |
else: | |
init_args = signature(gate).parameters | |
valid_angles = [arg for arg in init_args if arg in matrix] | |
angle_values = dict(zip(valid_angles, [params])) | |
if not isinstance(params, list): | |
params = [params] | |
init_args = signature(gate).parameters | |
valid_angles = [arg for arg in init_args if arg in angles] | |
angle_values = dict(zip(valid_angles, params)) |
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.
Thanks @renatomello for spotting this. I have made the changes. But still trying to get it to work. It's currently complaining
FAILED tests/test_tomography_gate_set_tomography.py::test_GST[numpy-False-target_gates0] - ValueError: axes don't match array
FAILED tests/test_tomography_gate_set_tomography.py::test_GST[numpy-True-target_gates0] - ValueError: axes don't match array
FAILED tests/test_tomography_gate_set_tomography.py::test_GST[qibojit-numba-False-target_gates0] - ValueError: axes don't match array
FAILED tests/test_tomography_gate_set_tomography.py::test_GST[qibojit-numba-True-target_gates0] - ValueError: axes don't match array
Will keep trying to debug.
@@ -233,8 +235,7 @@ def GST( | |||
gate_set (tuple or set or list): set of :class:`qibo.gates.Gate` and parameters to run | |||
GST on. | |||
E.g. gate_set = [(gates.RX, [np.pi/3]), gates.Z, (gates.PRX, [np.pi/2, np.pi/3]), | |||
(gates.GPI, [np.pi/7]), gates.CNOT, | |||
(gates.Unitary, (np.array([[1,0],[0,1]])))] | |||
(gates.GPI, [np.pi/7]), gates.CNOT] |
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 docstring is generating a warning when the documentation is compiled because of identation. I fixed it in #1584. Please look at it to also fix it here.
Hi @MatteoRobbiati, I need some advice with this. When I run the pytests locally, they pass. But here, they always run into dimension error:
Could there be an issue with Thanks so much! |
Ehi @mho291! Thanks for asking :) |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1587 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 77 77
Lines 11480 11518 +38
=======================================
+ Hits 11378 11416 +38
Misses 102 102
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi @MatteoRobbiati ! Sorry for the radio silence for the past two weeks as I was away. I revisited this PR yesterday and the tests no longer fail on GitHub (but not my local machine), so I tidied it up anyway, and it is ready for review now. Greatly appreciate your help! |
I have added an option for The ancilla flag, together with the ability to input |
Sorry, please hold the review, I will need to modify the current changes to increase the functionality! |
The code is now ready for review! :) |
Checklist: