qml.liealg.even_odd_involution¶
- even_odd_involution(op)[source]¶
The Even-Odd involution.
This is defined in quant-ph/0701193. For Pauli words and sentences, it comes down to counting non-trivial Paulis in Pauli words. For an even (odd) number of qubits, it is of type AI (AII).
- Parameters:
op (Union[PauliSentence, np.ndarray, Operator]) – Input operator
- Returns:
Boolean output
True
orFalse
for odd (\(\mathfrak{k}\)) and even parity subspace (\(\mathfrak{m}\)), respectively- Return type:
bool
See also
Example
>>> from pennylane import X, Y, Z >>> from pennylane.liealg import even_odd_involution >>> ops = [X(0), X(0) @ Y(1), X(0) @ Y(1) @ Z(2)] >>> [even_odd_involution(op) for op in ops] [True, False, True]
Operators with an odd number of non-identity Paulis yield
1
, whereas even ones yield0
.The function also works with dense matrix representations.
>>> ops_m = [qml.matrix(op, wire_order=range(3)) for op in ops] >>> [even_odd_involution(op_m) for op_m in ops_m] [True, False, True]
code/api/pennylane.liealg.even_odd_involution
Download Python script
Download Notebook
View on GitHub