View source on GitHub
  
 | 
A qid identified by name.
Inherits From: Qid
cirq.NamedQid(
    name: str, dimension: int
) -> cirq.NamedQid
By default, NamedQid has a lexicographic order. However, numbers within
the name are handled correctly. So, for example, if you print a circuit
containing cirq.NamedQid('qid22', dimension=3) and
cirq.NamedQid('qid3', dimension=3), the wire for 'qid3' will
correctly come before 'qid22'.
Args | |
|---|---|
name
 | 
The name. | 
dimension
 | 
The dimension of the qid's Hilbert space, i.e. the number of quantum levels. | 
Attributes | |
|---|---|
dimension
 | 
Returns the dimension or the number of quantum levels this qid has. E.g. 2 for a qubit, 3 for a qutrit, etc. | 
name
 | 
|
Methods
range
@staticmethodrange( *args, prefix: str, dimension: int ) -> list[NamedQid]
Returns a range of NamedQid\s.
The range returned starts with the prefix, and followed by a qid for each number in the range, e.g.:
<pre class="devsite-click-to-copy prettyprint lang-py">
<code class="devsite-terminal" data-terminal-prefix=">>>">cirq.NamedQid.range(3, prefix='a', dimension=3)</code>
<code class="devsite-terminal" data-terminal-prefix="..."># doctest: +NORMALIZE_WHITESPACE</code>
<code class="no-select nocode">    [cirq.NamedQid('a0', dimension=3), cirq.NamedQid('a1', dimension=3),</code>
<code class="no-select nocode">        cirq.NamedQid('a2', dimension=3)]</code>
<code class="devsite-terminal" data-terminal-prefix=">>>">cirq.NamedQid.range(2, 4, prefix='a', dimension=3)</code>
<code class="no-select nocode">    [cirq.NamedQid('a2', dimension=3), cirq.NamedQid('a3', dimension=3)]</code>
<code class="no-select nocode">    </code>
</pre>
| Args | |
|---|---|
*args
 | 
Args to be passed to Python's standard range function. | 
prefix
 | 
A prefix for constructed NamedQids. | 
dimension
 | 
The dimension of the qid's Hilbert space, i.e. the number of quantum levels. | 
| Returns | |
|---|---|
A list of NamedQid\s.
 | 
validate_dimension
@staticmethodvalidate_dimension( dimension: int ) -> None
Raises an exception if dimension is not positive.
| Raises | |
|---|---|
ValueError
 | 
dimension is not positive.
 | 
with_dimension
with_dimension(
    dimension: int
) -> NamedQid
Returns a new qid with a different dimension.
Child classes can override. Wraps the qubit object by default.
| Args | |
|---|---|
dimension
 | 
The new dimension or number of levels. | 
__eq__
__eq__(
    other
) -> bool
Return self==value.
__ge__
__ge__(
    other
) -> bool
Return self>=value.
__gt__
__gt__(
    other
) -> bool
Return self>value.
__le__
__le__(
    other
) -> bool
Return self<=value.
__lt__
__lt__(
    other
) -> bool
Return self<value.
__ne__
__ne__(
    other
) -> bool
Return self!=value.
    View source on GitHub