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

Gates do not check if complex inputs passed in #3282

Closed
nonhermitian opened this issue Oct 18, 2019 · 3 comments · Fixed by #3668 or #4181
Closed

Gates do not check if complex inputs passed in #3282

nonhermitian opened this issue Oct 18, 2019 · 3 comments · Fixed by #3668 or #4181
Labels
bug Something isn't working priority: low status: pending PR It has one or more PRs pending to solve this issue

Comments

@nonhermitian
Copy link
Contributor

Information

  • Qiskit Terra version: master
  • Python version:
  • Operating system:

What is the current behavior?

This works:

from qiskit import *

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.rx(1+1j, 0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])

qc.draw()

but it should not. It only gets caught later with:

TypeError: can't convert complex to float

Steps to reproduce the problem

What is the expected behavior?

Suggested solutions

@nonhermitian nonhermitian added the bug Something isn't working label Oct 18, 2019
@1ucian0
Copy link
Member

1ucian0 commented Nov 15, 2019

We support several types as parameters (symbolic, numpy types, ...). Making type checking at gate construction time might be expensive. Do we want to go that way?

@nonhermitian
Copy link
Contributor Author

@1ucian0 Not sure why checking for the validity of inputs is "low priority" in your mind? Also, we do a fair bit of type checking already for parameters, just not in the sanity checking sense:

https://github.com/Qiskit/qiskit-terra/blob/89cb7afc68b02850565f04851f1c17359afcf52c/qiskit/circuit/instruction.py#L137

@1ucian0 1ucian0 added the status: pending PR It has one or more PRs pending to solve this issue label Jan 2, 2020
@mergify mergify bot closed this as completed in #3668 Apr 9, 2020
@1ucian0
Copy link
Member

1ucian0 commented Apr 19, 2020

Reopening, since #3668 was reverted in #4117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: low status: pending PR It has one or more PRs pending to solve this issue
Projects
None yet
2 participants