deltakit.circuit.NoiseContext.gate_layer_qubits#
- NoiseContext.gate_layer_qubits(gate_t: type[Gate] | tuple[type[Gate], ...] | None, gate_qubit_count: int | None = None) Sequence[Qubit]#
Returns all the qubits that belong to gates of type gate_t in self.gate_layer’s gates with optional gate qubit count selector. If gate_t and gate_qubit_count are both None, all the qubits operated upon in self.gate_layer are returned.
Parameters:#
- gate_tType[Gate] | Tuple[Type[Gate], …] | None
The gate type over which noise should be applied. If None, all the qubits operated upon in this gate_layer are returned.
- gate_qubit_countOptional[int] = None
Selector for gates which act on this amount of qubits. If None, gates may act on an arbitrary amount of qubits.
Examples:#
>>> import deltakit_circuit as sp >>> from deltakit_circuit._noise_factory import NoiseContext >>> gate_layer = sp.GateLayer( ... [sp.gates.H(0), sp.gates.CX(1, 2), sp.gates.MX(4)] ... ) >>> deltakit_circuit_circuit = sp.Circuit(gate_layer) >>> noise_context = NoiseContext(deltakit_circuit_circuit, gate_layer) >>> list(noise_context.gate_layer_qubits(sp.gates.H)) [Qubit(0)] >>> list(noise_context.gate_layer_qubits((sp.gates.H, sp.gates.CX))) [Qubit(0), Qubit(1), Qubit(2)] >>> list(noise_context.gate_layer_qubits(None)) [Qubit(0), Qubit(1), Qubit(2), Qubit(4)]