pprop.gates.base module¶
This module defines Gate, the abstract base class for all quantum gates
in the Pauli propagation framework.
- class pprop.gates.base.Gate(qml_gate, wires, parameter=None)[source]¶
Bases:
ABCAbstract base class for all quantum gates.
Each concrete gate subclass stores a PennyLane operator instance for circuit drawing and a Heisenberg evolution rule used during Pauli propagation. The constructor validates that the number of wires and the presence or absence of a parameter are consistent with the PennyLane gate’s expectations.
- Parameters:
qml_gate (pennylane.operation.Operation) – PennyLane gate class (not instance) corresponding to this gate. The constructor instantiates it with a placeholder parameter value of
1(for parametrised gates) or without parameters (for non-parametrised gates).wires (list[int]) – Qubit indices on which this gate acts.
parameter (float, int, optional) – If it is np.intp or np.integer it represents the tndex of \(\theta\) in the global parameter vector. If it is float, it is actually an assigned value to the gate. If it is None, the gate is non-parametrised.
- qml_gate¶
Instantiated PennyLane operator, used for circuit drawing.
- Type:
pennylane.operation.Operation
- wires¶
Qubit indices on which this gate acts.
- Type:
list[int]
- parameter¶
Value of the parametrized gate if float, index into the global parameter vector if int, or
Nonefor non-parametrised gates.- Type:
int or None
- Raises:
ValueError – If the number of wires does not match the gate’s requirement.
ValueError – If the gate expects more than one parameter (unsupported).
ValueError – If a parametrised gate is constructed without a
parameter_index.ValueError – If a non-parametrised gate is constructed with a
parameter_index.
- Parameters:
qml_gate (Operation)
wires (List[int])
parameter (Optional[int])
- abstractmethod evolve(word, k1, k2)[source]¶
Heisenberg-evolve a Pauli word through this gate.
Computes \(G^\dagger\, P\, G\) for the Pauli word \(P\) encoded in
word, where \(G\) is this gate. The result is returned as aPauliDictmapping each output Pauli word to its updatedCoeffTerms.Subclasses may return an empty
PauliDictto signal that the evolved word has been truncated by a cutoff.- Parameters:
word (tuple[PauliOp, CoeffTerms]) –
(pauliop, coeff_terms)pair representing the Pauli word to evolve and its current symbolic coefficient.k1 (int or None) – Pauli weight cutoff. Evolved words whose weight exceeds
k1are discarded.Nonedisables weight truncation.k2 (int or None) – Frequency cutoff. Evolved terms whose trigonometric frequency exceeds
k2are discarded.Nonedisables frequency truncation.
- Returns:
The evolved Pauli word(s) with updated coefficients. May be empty if the result was truncated by
k1ork2.- Return type: