qml.is_commuting¶
- is_commuting(operation1, operation2)[source]¶
Check if two operations are commuting using a lookup table.
A lookup table is used to check the commutation between the controlled, targeted part of operation 1 with the controlled, targeted part of operation 2.
Note
Most qubit-based PennyLane operations are supported — CV operations are not supported at this time.
Unsupported qubit-based operations include:
PauliRot
,QubitDensityMatrix
,CVNeuralNetLayers
,ApproxTimeEvolution
,ArbitraryUnitary
,CommutingEvolution
,DisplacementEmbedding
,SqueezingEmbedding
Exp
- Parameters
- Returns
True if the operations commute, False otherwise.
- Return type
bool
Example
>>> qml.is_commuting(qml.X(0), qml.Z(0)) False
code/api/pennylane.is_commuting
Download Python script
Download Notebook
View on GitHub