-
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.
Relax wire_order restrictions in circuit visualization (#9893)
* first attempt * fixing * other drawers * revert test/ipynb/mpl_tester.ipynb * corner case * latex test * reno * readjust based on #9893 (comment) * default complete_wire_order * test adjustmet * bug in length * readjust tests * ref * remove old ref * new ref * revert https://github.com/Qiskit/qiskit-terra/pull/9893/files#r1259615851 * remove tests because they do not cover the extended code * reno fix
- Loading branch information
Showing
3 changed files
with
131 additions
and
24 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
34 changes: 34 additions & 0 deletions
34
releasenotes/notes/relax_wire_order_restrictions-ffc0cfeacd7b8d4b.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,34 @@ | ||
--- | ||
features: | ||
- | | ||
Some restrictions when using ``wire_order`` in the circuit drawers had been relaxed. | ||
Now, ``wire_order`` can list just qubits and, in that case, it can be used | ||
with ``cregbundle=True``, since it will not affect the classical bits. | ||
.. code-block:: | ||
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister | ||
qr = QuantumRegister(4, "q") | ||
cr = ClassicalRegister(4, "c") | ||
cr2 = ClassicalRegister(2, "ca") | ||
circuit = QuantumCircuit(qr, cr, cr2) | ||
circuit.h(0) | ||
circuit.h(3) | ||
circuit.x(1) | ||
circuit.x(3).c_if(cr, 10) | ||
circuit.draw('text', wire_order=[2, 3, 0, 1], cregbundle=True) | ||
.. parsed-literal:: | ||
q_2: ──────────── | ||
┌───┐ ┌───┐ | ||
q_3: ┤ H ├─┤ X ├─ | ||
├───┤ └─╥─┘ | ||
q_0: ┤ H ├───╫─── | ||
├───┤ ║ | ||
q_1: ┤ X ├───╫─── | ||
└───┘┌──╨──┐ | ||
c: 4/═════╡ 0xa ╞ | ||
└─────┘ | ||
ca: 2/════════════ |
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