-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix zero-operand gates and instructions A few checks in different places didn't account for zero-operand gates being possible. In most uses, there never would be anything useful here, but it can occasionally be useful to create a "global-phase" instruction, especially if this is later going to have controls applied to it. This is well-formed within the Qiskit data model; spectator qubits implicitly undergo the identity, so this corresponds to the global phase being multiplied by the identity on _all_ qubits. * Fix controlled-gate qubit-number documentation * Add ScalarOp test * Be stricter about allowed num_ctrl_qubits Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit bb93592) Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
- Loading branch information
1 parent
8c15424
commit ad6f295
Showing
9 changed files
with
112 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
releasenotes/notes/fix-zero-operand-gates-323510ec8f392f27.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
fixes: | ||
- | | ||
Zero-operand gates and instructions will now work with | ||
:func:`.circuit_to_gate`, :meth:`.QuantumCircuit.to_gate`, | ||
:meth:`.Gate.control`, and the construction of an | ||
:class:`~.quantum_info.Operator` from a :class:`.QuantumCircuit` containing | ||
zero-operand instructions. This edge case is occasionally useful in creating | ||
global-phase gates as part of larger compound instructions, though for many | ||
uses, :attr:`.QuantumCircuit.global_phase` may be more appropriate. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters