A qubit identified by name.

Inherits From: Qid

Used in the notebooks

Used in the tutorials

By default, NamedQubit has a lexicographic order. However, numbers within the name are handled correctly. So, for example, if you print a circuit containing cirq.NamedQubit('qubit22') and cirq.NamedQubit('qubit3'), the wire for 'qubit3' will correctly come before 'qubit22'.

dimension Returns the dimension or the number of quantum levels this qid has. E.g. 2 for a qubit, 3 for a qutrit, etc.



View source

Returns a range of cirq.NamedQubits.

The range returned starts with the prefix, and followed by a qubit for each number in the range, e.g.:

<pre class="devsite-click-to-copy prettyprint lang-py">
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">cirq.NamedQubit.range(3, prefix=&#x27;a&#x27;)</code>
<code class="devsite-terminal" data-terminal-prefix="..."># doctest: +NORMALIZE_WHITESPACE</code>
<code class="no-select nocode">    [cirq.NamedQubit(&#x27;a0&#x27;), cirq.NamedQubit(&#x27;a1&#x27;),</code>
<code class="no-select nocode">        cirq.NamedQubit(&#x27;a2&#x27;)]</code>
<code class="devsite-terminal" data-terminal-prefix="&gt;&gt;&gt;">cirq.NamedQubit.range(2, 4, prefix=&#x27;a&#x27;)</code>
<code class="no-select nocode">    [cirq.NamedQubit(&#x27;a2&#x27;), cirq.NamedQubit(&#x27;a3&#x27;)]</code>
<code class="no-select nocode">    </code>

*args Args to be passed to Python's standard range function.
prefix A prefix for constructed NamedQubits.

A list of NamedQubit\s.


View source

Raises an exception if dimension is not positive.

ValueError dimension is not positive.


View source

Returns a new qid with a different dimension.

Child classes can override. Wraps the qubit object by default.

dimension The new dimension or number of levels.


View source

Return self==value.


View source

Return self>=value.


View source

Return self>value.


View source

Return self<=value.


View source

Return self<value.


View source

Return self!=value.