qml.operation.enable_new_opmath

enable_new_opmath()[source]

Change dunder methods to return arithmetic operators instead of Hamiltonians and Tensors

Example

>>> qml.operation.active_new_opmath()
False
>>> type(qml.PauliX(0) @ qml.PauliZ(1))
<class 'pennylane.operation.Tensor'>
>>> qml.operation.enable_new_opmath()
>>> type(qml.PauliX(0) @ qml.PauliZ(1))
<class 'pennylane.ops.op_math.prod.Prod'>