-
Notifications
You must be signed in to change notification settings - Fork 355
Open
Labels
bug 🐛An issue that needs fixing.An issue that needs fixing.
Description
Pre-Report Checklist
- I am running the latest versions of pyQuil and the Forest SDK
- I checked to make sure that this bug has not already been reported
Issue Description
I tried using BARENCO gate, i understand its experimental feature. But, the gate seems to provide non-unitary matrix when used with the following values.
{'alpha': -0.033780566167632184, 'phi': 0.0320570678937734, 'theta': 1.0471975511965976}
How to Reproduce
Code Snippet
from pyquil.simulation.matrices import *
from pyquil import Program
from pyquil.quilbase import DefGate
circuit = Program()
matrix = BARENCO(**{'alpha': -0.033780566167632184, 'phi': 0.0320570678937734, 'theta': 1.0471975511965976})
customgate = DefGate(f'BARENCO', matrix)
CUSTOM_GATE = customgate.get_constructor()
circuit += customgate
circuit += CUSTOM_GATE(0,1)Error Output
customgate = DefGate(f'BARENCO', matrix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxx/quilenv/lib/python3.11/site-packages/pyquil/quilbase.py", line 683, in __new__
DefGate._validate_matrix(matrix, parameters is not None and len(parameters) > 0)
File "/Users/xxx/quilenv/lib/python3.11/site-packages/pyquil/quilbase.py", line 721, in _validate_matrix
raise ValueError("Matrix must be unitary.")
ValueError: Matrix must be unitary.Environment Context
Operating System:
Python Version (python -V): 3.11
Quilc Version (quilc --version): 1.23.0
QVM Version (qvm --version): 1.17.1
Python Environment Details (pip freeze or conda list):
pyquil = 4.14.3
Metadata
Metadata
Assignees
Labels
bug 🐛An issue that needs fixing.An issue that needs fixing.