qml.transforms.simplify¶
-
simplify
(operation)[source]¶ Simplify the (controlled) rotation operations
Rot
,U2
,U3
, andCRot
into one ofRX
,CRX
,RY
,CRY
,RZ
,CZ
,Hadamard
and controlled-Hadamard where possible.- Parameters
operation (Operation) – Rotation or controlled rotation.
- Returns
An operation representing the simplified rotation, if possible. Otherwise, the original operation is returned.
- Return type
Example
You can simplify rotation with certain parameters, for example:
>>> qml.simplify(qml.Rot(np.pi / 2, 0.1, -np.pi / 2, wires=0)) qml.RX(0.1, wires=0)
However, not every rotation can be simplified. The original operation is returned if no simplification is possible.
>>> qml.simplify(qml.Rot(0.1, 0.2, 0.3, wires=0)) qml.Rot(0.1, 0.2, 0.3, wires=0)
code/api/pennylane.transforms.simplify
Download Python script
Download Notebook
View on GitHub