-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
no validity check on Target construction #8914
Comments
I also feel like this shouldn't be valid, but currently is: target = Target(2)
target.add_instruction(CXGate()) i.e. adding an instruction to unknown qubits. It will later fail if we try to do things like |
For the main issue: seems fine to me to add the checks, unless Matthew has reasons not to. Your newest comment looks like a bug in |
Yeah I think this 2nd one is a bug, and is currently blocking #8917 by causing 2 tests to fail. |
So the first point is half a feature half a bug. The
To make a target with 3 qubits. The idea behind that was for generating target's programmatically it was easier to just parse an instructions payload and get a valid target without having to know the number of qubits ahead of time. But I agree it's a bug that we're not validating the number of qubits matches the operation width. The second thing is definitely a bug as we should check the number of qubits for globally defined operations and return them in |
This commit fixes the handling in the target for working with instructions defined globally in the target. It adds handling to the operation_names_for_qargs() and operations_for_qargs() methods to build outputs that include globally defined operations instead of ignoring them. Additionally the add_instruction() method is updated to validate the input qargs to ensure that only valid qubits and qargs are allowed to be added to the target for an instruction. Fixes Qiskit#8914
This commit fixes the handling in the target for working with instructions defined globally in the target. It adds handling to the operation_names_for_qargs() and operations_for_qargs() methods to build outputs that include globally defined operations instead of ignoring them. Additionally the add_instruction() method is updated to validate the input qargs to ensure that only valid qubits and qargs are allowed to be added to the target for an instruction. Fixes #8914 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit fixes the handling in the target for working with instructions defined globally in the target. It adds handling to the operation_names_for_qargs() and operations_for_qargs() methods to build outputs that include globally defined operations instead of ignoring them. Additionally the add_instruction() method is updated to validate the input qargs to ensure that only valid qubits and qargs are allowed to be added to the target for an instruction. Fixes #8914 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 3a073c7)
This commit fixes the handling in the target for working with instructions defined globally in the target. It adds handling to the operation_names_for_qargs() and operations_for_qargs() methods to build outputs that include globally defined operations instead of ignoring them. Additionally the add_instruction() method is updated to validate the input qargs to ensure that only valid qubits and qargs are allowed to be added to the target for an instruction. Fixes Qiskit#8914 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit fixes the handling in the target for working with instructions defined globally in the target. It adds handling to the operation_names_for_qargs() and operations_for_qargs() methods to build outputs that include globally defined operations instead of ignoring them. Additionally the add_instruction() method is updated to validate the input qargs to ensure that only valid qubits and qargs are allowed to be added to the target for an instruction. Fixes #8914 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 3a073c7) Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Environment
What is happening?
It's possible to build a Target where the Instruction does not match the number of qubits it's being added to.
How can we reproduce the issue?
For example here I add a 1-qubit gate to a two-qubit tuple.
What should happen?
raise Error
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: