Skip to content

Commit b2d3df0

Browse files
Remove gif (Qiskit#13616)
* 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]>
1 parent 2476188 commit b2d3df0

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

docs/source_images/depth.gif

-2.74 MB
Binary file not shown.

qiskit/circuit/quantumcircuit.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -889,27 +889,6 @@ class QuantumCircuit:
889889
890890
assert qc.size() == 19
891891
892-
A particularly important circuit property is known as the circuit :meth:`depth`. The depth
893-
of a quantum circuit is a measure of how many "layers" of quantum gates, executed in
894-
parallel, it takes to complete the computation defined by the circuit. Because quantum
895-
gates take time to implement, the depth of a circuit roughly corresponds to the amount of
896-
time it takes the quantum computer to execute the circuit. Thus, the depth of a circuit
897-
is one important quantity used to measure if a quantum circuit can be run on a device.
898-
899-
The depth of a quantum circuit has a mathematical definition as the longest path in a
900-
directed acyclic graph (DAG). However, such a definition is a bit hard to grasp, even for
901-
experts. Fortunately, the depth of a circuit can be easily understood by anyone familiar
902-
with playing `Tetris <https://en.wikipedia.org/wiki/Tetris>`_. Lets see how to compute this
903-
graphically:
904-
905-
.. image:: /source_images/depth.gif
906-
:alt: Rotate the circuit and let each gate fall as far as possible. The gates fall \
907-
into "layers". The depth of the circuit is the number of layers.
908-
909-
We can verify our graphical result using :meth:`QuantumCircuit.depth`::
910-
911-
assert qc.depth() == 9
912-
913892
.. automethod:: count_ops
914893
.. automethod:: depth
915894
.. automethod:: get_instructions
@@ -3490,6 +3469,14 @@ def depth(
34903469
) -> int:
34913470
"""Return circuit depth (i.e., length of critical path).
34923471
3472+
The depth of a quantum circuit is a measure of how many
3473+
"layers" of quantum gates, executed in parallel, it takes to
3474+
complete the computation defined by the circuit. Because
3475+
quantum gates take time to implement, the depth of a circuit
3476+
roughly corresponds to the amount of time it takes the quantum
3477+
computer to execute the circuit.
3478+
3479+
34933480
.. warning::
34943481
This operation is not well defined if the circuit contains control-flow operations.
34953482

0 commit comments

Comments
 (0)