@@ -112,9 +112,10 @@ def map_operations(
112
112
raise_if_add_qubits = True ,
113
113
tags_to_ignore : Sequence [Hashable ] = (),
114
114
) -> CIRCUIT_TYPE :
115
- """Applies local transformations on operations , by calling `map_func(op)` for each op .
115
+ """Applies local transformations, by calling `map_func(op, moment_index )` for each operation .
116
116
117
- By default, the function assumes `issubset(qubit_set(map_func(op)), op.qubits)` is True.
117
+ By default, the function assumes `issubset(qubit_set(map_func(op, moment_index)), op.qubits)` is
118
+ True.
118
119
119
120
Args:
120
121
circuit: Input circuit to apply the transformations on. The input circuit is not mutated.
@@ -125,14 +126,14 @@ def map_operations(
125
126
subsequently be used to unroll the mapped circuit operation.
126
127
deep: If true, `map_func` will be recursively applied to circuits wrapped inside
127
128
any circuit operations contained within `circuit`.
128
- raise_if_add_qubits: Set to True by default. If True, raises ValueError if `map_func(op)`
129
- adds operations on qubits outside of `op.qubits`.
129
+ raise_if_add_qubits: Set to True by default. If True, raises ValueError if
130
+ `map_func(op, idx)` adds operations on qubits outside of `op.qubits`.
130
131
tags_to_ignore: Sequence of tags which should be ignored while applying `map_func` on
131
132
tagged operations -- i.e. `map_func(op, idx)` will be called only for operations that
132
133
satisfy `set(op.tags).isdisjoint(tags_to_ignore)`.
133
134
134
135
Raises:
135
- ValueError if `issubset(qubit_set(map_func(op)), op.qubits) is False` and
136
+ ValueError if `issubset(qubit_set(map_func(op, idx )), op.qubits) is False` and
136
137
`raise_if_add_qubits is True`.
137
138
138
139
Returns:
@@ -180,8 +181,8 @@ def map_operations_and_unroll(
180
181
map_func: Mapping function from (cirq.Operation, moment_index) to a cirq.OP_TREE.
181
182
deep: If true, `map_func` will be recursively applied to circuits wrapped inside
182
183
any circuit operations contained within `circuit`.
183
- raise_if_add_qubits: Set to True by default. If True, raises ValueError if `map_func(op)`
184
- adds operations on qubits outside of `op.qubits`.
184
+ raise_if_add_qubits: Set to True by default. If True, raises ValueError if
185
+ `map_func(op, idx)` adds operations on qubits outside `op.qubits`.
185
186
tags_to_ignore: Sequence of tags which should be ignored while applying `map_func` on
186
187
tagged operations -- i.e. `map_func(op, idx)` will be called only for operations that
187
188
satisfy `set(op.tags).isdisjoint(tags_to_ignore)`.
0 commit comments