12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ """Transformers that symbolizes operations."""
16
+
15
17
import re
16
18
from typing import Hashable , Optional , TYPE_CHECKING
17
19
@@ -37,21 +39,22 @@ def symbolize_single_qubit_gates_by_indexed_tags(
37
39
context : Optional ['cirq.TransformerContext' ] = None ,
38
40
symbolize_tag : SymbolizeTag = SymbolizeTag (prefix = "TO-PHXZ" ),
39
41
) -> 'cirq.Circuit' :
40
- """Symbolizes single qubit operations by indexed tags prefixed by tag_prefix .
42
+ """Symbolizes single qubit operations by indexed tags prefixed by symbolize_tag.prefix .
41
43
42
44
Example:
45
+ >>> from cirq import transformers
43
46
>>> q0, q1 = cirq.LineQubit.range(2)
44
- >>> c = cirq.Circuit(\
45
- cirq.X(q0).with_tags("phxz_0"),\
46
- cirq.CZ(q0,q1),\
47
- cirq.Y(q0).with_tags("phxz_1"),\
48
- cirq.X(q0))
47
+ >>> c = cirq.Circuit(
48
+ ... cirq.X(q0).with_tags("phxz_0"),
49
+ ... cirq.CZ(q0,q1),
50
+ ... cirq.Y(q0).with_tags("phxz_1"),
51
+ ... cirq.X(q0))
49
52
>>> print(c)
50
53
0: ───X[phxz_0]───@───Y[phxz_1]───X───
51
54
│
52
55
1: ───────────────@───────────────────
53
- >>> new_circuit = cirq.symbolize_single_qubit_gates_by_indexed_tags(\
54
- c, symbolize_tag=cirq. transformers.symbolize .SymbolizeTag(prefix="phxz"))
56
+ >>> new_circuit = cirq.symbolize_single_qubit_gates_by_indexed_tags(
57
+ ... c, symbolize_tag=transformers.SymbolizeTag(prefix="phxz"))
55
58
>>> print(new_circuit)
56
59
0: ───PhXZ(a=a0,x=x0,z=z0)───@───PhXZ(a=a1,x=x1,z=z1)───X───
57
60
│
0 commit comments