deltakit.circuit.GateLayer.replace_gates#

GateLayer.replace_gates(replacement_policy: GateReplacementPolicy)#

Replace all gates according to the gate replacement policy

Replacing a measurement gate with a non measurement gate or a non measurement gate with a measurement gate will lead to unexpected behaviour

Parameters:

replacement_policy (Mapping[Type[GateT] | GateT,) –

Callable[[GateT], GateT]] A mapping from gates or gate types to be replaced in this gate layer to the callables that return the new gate.

If the key in the mapping is a type, all gates of that type will be replaced according to the associated callble. Otherwise, if the key is an instance of a particular gate, all gates that are equal to that particular gate will be changed according to the associated callable.