cirq.symbolize_single_qubit_gates_by_indexed_tags
Symbolizes single qubit operations by indexed tags prefixed by symbolize_tag.prefix.
cirq.symbolize_single_qubit_gates_by_indexed_tags(
circuit: cirq.AbstractCircuit,
*,
context: (cirq.TransformerContext | None) = None,
symbolize_tag: SymbolizeTag = SymbolizeTag(prefix='TO-PHXZ')
) -> cirq.Circuit
Example |
>>> from cirq import transformers
>>> q0, q1 = cirq.LineQubit.range(2)
>>> c = cirq.Circuit(
... cirq.X(q0).with_tags("phxz_0"),
... cirq.CZ(q0,q1),
... cirq.Y(q0).with_tags("phxz_1"),
... cirq.X(q0))
>>> print(c)
</td>
</tr>
<tr>
<td>
`0`<a id="0"></a>
</td>
<td>
───X[phxz_0]───@───Y[phxz_1]───X───
│
</td>
</tr><tr>
<td>
`1`<a id="1"></a>
</td>
<td>
───────────────@───────────────────
>>> new_circuit = cirq.symbolize_single_qubit_gates_by_indexed_tags(
... c, symbolize_tag=transformers.SymbolizeTag(prefix="phxz"))
>>> print(new_circuit)
</td>
</tr><tr>
<td>
`0`<a id="0"></a>
</td>
<td>
───PhXZ(a=a0,x=x0,z=z0)───@───PhXZ(a=a1,x=x1,z=z1)───X───
│
</td>
</tr><tr>
<td>
`1`<a id="1"></a>
</td>
<td>
──────────────────────────@──────────────────────────────
|
Args |
circuit
|
Input circuit to apply the transformations on. The input circuit is not mutated.
|
context
|
cirq.TransformerContext storing common configurable options for transformers.
|
symbolize_tag
|
The tag info used to symbolize the phxz gate. Prefix is required.
|
Returns |
Copy of the transformed input circuit.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 UTC."],[],[]]