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

lifted_gate does not guard against parameterised gates #995

Closed
notmgsk opened this issue Sep 12, 2019 · 1 comment
Closed

lifted_gate does not guard against parameterised gates #995

notmgsk opened this issue Sep 12, 2019 · 1 comment
Labels
bug 🐛 An issue that needs fixing. good first issue 👶 A place to get started.
Milestone

Comments

@notmgsk
Copy link
Contributor

notmgsk commented Sep 12, 2019

lifted_gate does not guard against parameterised gates.

lifted_gate does not guard against parameterised gates.

In [6]: lifted_gate(Program("RX(%theta) 0")[0], 1)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-b6c85b4cfc00> in <module>
----> 1 lifted_gate(Program("RX(%theta) 0")[0], 1)

~/hackery/python/pyquil/pyquil/unitary_tools.py in lifted_gate(gate, n_qubits)
    321                 raise TypeError("Unsupported gate modifier {}".format(mod))
    322
--> 323     matrix = _gate_matrix(gate)
    324
    325     return lifted_gate_matrix(matrix=matrix,

~/hackery/python/pyquil/pyquil/unitary_tools.py in _gate_matrix(gate)
    295         if len(gate.modifiers) == 0:         # base case
    296             if len(gate.params) > 0:
--> 297                 return QUANTUM_GATES[gate.name](*gate.params)
    298             else:
    299                 return QUANTUM_GATES[gate.name]

~/hackery/python/pyquil/pyquil/gate_matrices.py in RX(phi)
    105
    106 def RX(phi):
--> 107     return np.array([[np.cos(phi / 2.0), -1j * np.sin(phi / 2.0)],
    108                      [-1j * np.sin(phi / 2.0), np.cos(phi / 2.0)]])
    109

AttributeError: 'Div' object has no attribute 'cos'
@notmgsk notmgsk added the bug 🐛 An issue that needs fixing. label Sep 12, 2019
@notmgsk notmgsk changed the title lifted_gate does not guard against parameterised gates lifted_gate does not guard against parameterised gates Sep 12, 2019
@notmgsk notmgsk added the good first issue 👶 A place to get started. label Sep 12, 2019
@karalekas
Copy link
Contributor

Closed by #1012

@karalekas karalekas added this to the v2.12 milestone Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue that needs fixing. good first issue 👶 A place to get started.
Projects
None yet
Development

No branches or pull requests

2 participants