pprop.gates.controlled module

This submodule defines ControlledGate, the base class for two-qubit non-parametrised controlled gates, and the concrete gates CNOT, CY, and CZ.

class pprop.gates.controlled.CNOT(wires, parameter=None)[source]

Bases: ControlledGate

The Controlled-NOT (CX) gate.

\[\begin{split}\text{CNOT} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix}\end{split}\]

The Heisenberg evolution maps each two-qubit Pauli string control target according to the rule dict. All other combinations commute with the gate.

Parameters:
  • wires (list[int]) – [control, target] qubit indices.

  • parameter (float, int, optional) – Unused. Defaults to None.

class pprop.gates.controlled.CY(wires, parameter=None)[source]

Bases: ControlledGate

The Controlled-Y gate.

\[\begin{split}\text{CY} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & -i \\ 0 & 0 & i & 0 \end{bmatrix}\end{split}\]
Parameters:
  • wires (list[int]) – [control, target] qubit indices.

  • parameter (float, int, optional) – Unused. Defaults to None.

class pprop.gates.controlled.CZ(wires, parameter=None)[source]

Bases: ControlledGate

The Controlled-Z gate.

\[\begin{split}\text{CZ} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix}\end{split}\]
Parameters:
  • wires (list[int]) – [control, target] qubit indices.

  • parameter (float, int, optional) – Unused. Defaults to None.

class pprop.gates.controlled.ControlledGate(wires, qml_gate, parameter, rule)[source]

Bases: Gate

Base class for two-qubit non-parametrised controlled gates.

The Heisenberg evolution rule is encoded as a dict keyed by two-character strings "PQ" where P is the Pauli at the control wire and Q is the Pauli at the target wire. Each entry maps to an ((output_control, output_target), sign) tuple. Two-qubit Pauli combinations absent from the dict commute with the gate and pass through unchanged.

Parameters:
  • wires (list[int]) – [control, target] qubit indices.

  • qml_gate (pennylane.operation.Operator) – Corresponding PennyLane gate class, used for circuit drawing.

  • parameter (int or None) – Index into the parameter vector. Controlled gates are non-parametrised, so this is always None.

  • rule (EvolutionRule) – Dict mapping a two-character Pauli string (e.g. "IY") to a ((output_control, output_target), sign) pair.

rule

The Heisenberg evolution rule for this gate.

Type:

EvolutionRule

evolve(word, k1, k2)[source]

Heisenberg-evolve a Pauli word through this controlled gate.

Looks up the two-character Pauli string op[control] + op[target] in self.rule. If absent the word commutes with the gate and is returned unchanged. Otherwise both qubits are updated and all scalar coefficients are multiplied by the sign.

After applying the rule, the evolved word is checked against the Pauli weight cutoff k1. If its weight exceeds k1 it is discarded entirely (returning an empty PauliDict).

Parameters:
  • word (tuple[PauliOp, CoeffTerms]) – (pauliop, coeff_terms) pair to evolve.

  • k1 (int or None) – Pauli weight cutoff. Evolved words with weight exceeding k1 are discarded. None disables truncation.

  • k2 (int or None) – Frequency cutoff (unused, controlled gates do not change frequency).

Returns:

Empty if truncated by k1; one entry otherwise.

Return type:

PauliDict