Skip to content

Commit

Permalink
Remove gif (#13616)
Browse files Browse the repository at this point in the history
* Remove gif

* Delete depth.gif

* Add explanatory snippet to depth method

* code review

Co-authored-by: Eric Arellano <[email protected]>

* Update quantumcircuit.py

---------

Co-authored-by: Eric Arellano <[email protected]>
(cherry picked from commit b2d3df0)
  • Loading branch information
abbycross authored and mergify[bot] committed Jan 10, 2025
1 parent 4a2a92a commit a51c417
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
Binary file removed docs/source_images/depth.gif
Binary file not shown.
29 changes: 8 additions & 21 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,27 +888,6 @@ class QuantumCircuit:
assert qc.size() == 19
A particularly important circuit property is known as the circuit :meth:`depth`. The depth
of a quantum circuit is a measure of how many "layers" of quantum gates, executed in
parallel, it takes to complete the computation defined by the circuit. Because quantum
gates take time to implement, the depth of a circuit roughly corresponds to the amount of
time it takes the quantum computer to execute the circuit. Thus, the depth of a circuit
is one important quantity used to measure if a quantum circuit can be run on a device.
The depth of a quantum circuit has a mathematical definition as the longest path in a
directed acyclic graph (DAG). However, such a definition is a bit hard to grasp, even for
experts. Fortunately, the depth of a circuit can be easily understood by anyone familiar
with playing `Tetris <https://en.wikipedia.org/wiki/Tetris>`_. Lets see how to compute this
graphically:
.. image:: /source_images/depth.gif
:alt: Rotate the circuit and let each gate fall as far as possible. The gates fall \
into "layers". The depth of the circuit is the number of layers.
We can verify our graphical result using :meth:`QuantumCircuit.depth`::
assert qc.depth() == 9
.. automethod:: count_ops
.. automethod:: depth
.. automethod:: get_instructions
Expand Down Expand Up @@ -3489,6 +3468,14 @@ def depth(
) -> int:
"""Return circuit depth (i.e., length of critical path).
The depth of a quantum circuit is a measure of how many
"layers" of quantum gates, executed in parallel, it takes to
complete the computation defined by the circuit. Because
quantum gates take time to implement, the depth of a circuit
roughly corresponds to the amount of time it takes the quantum
computer to execute the circuit.
.. warning::
This operation is not well defined if the circuit contains control-flow operations.
Expand Down

0 comments on commit a51c417

Please sign in to comment.