-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for circuit.draw(initial_state=False) (#4068)
* internal option * external API * testing * lint * clean * seed in the transpiler * simpler test * latex support * maxdiff * docstring * doc * wire * ket is special * reno * initial_state * more refactor * reno lint * Update releasenotes/notes/initial_state_draw_parameter-f360ac4e998ee944.yaml Co-Authored-By: Matthew Treinish <mtreinish@kortar.org> * Update releasenotes/notes/initial_state_draw_parameter-f360ac4e998ee944.yaml Co-Authored-By: Matthew Treinish <mtreinish@kortar.org> * Update releasenotes/notes/initial_state_draw_parameter-f360ac4e998ee944.yaml Co-Authored-By: Matthew Treinish <mtreinish@kortar.org> * release note * release note section * examples with text drawer * import * maybe with an extra space Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
eff3630
commit c614eec
Showing
7 changed files
with
186 additions
and
104 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
41 changes: 41 additions & 0 deletions
41
releasenotes/notes/initial_state_draw_parameter-f360ac4e998ee944.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,41 @@ | ||
--- | ||
upgrade: | ||
- | | ||
The :class:`~qiskit.circuit.QuantumCircuit` method :meth:`~qiskit.circuit.QuantumCircuit.draw` | ||
and :func:`qiskit.visualization.circuit_drawer` function will no longer include the initial | ||
state included in visualizations by default. If you would like to retain the initial state in | ||
the output visualization you need to set the ``initial_state`` kwarg to ``True``. For example, | ||
running: | ||
.. jupyter-execute:: | ||
from qiskit import QuantumCircuit | ||
circuit = QuantumCircuit(2) | ||
circuit.measure_all() | ||
circuit.draw(output='text') | ||
This no longer includes the initial state. If you'd like to retain it you can run: | ||
.. jupyter-execute:: | ||
from qiskit import QuantumCircuit | ||
circuit = QuantumCircuit(2) | ||
circuit.measure_all() | ||
circuit.draw(output='text', initial_state=True) | ||
features: | ||
- | | ||
A new kwarg, ``initial_state`` has been added to the :func:`qiskit.visualization.circuit_drawer` | ||
function and the :class:`~qiskit.circuit.QuantumCircuit` method | ||
:meth:`~qiskit.circuit.QuantumCircuit.draw`. When set to ``True`` the initial state will be included | ||
in circuit visualizations for all backends. For example: | ||
.. jupyter-execute:: | ||
from qiskit import QuantumCircuit | ||
circuit = QuantumCircuit(2) | ||
circuit.measure_all() | ||
circuit.draw(output='text', initial_state=True) |
Oops, something went wrong.