qml.operation.disable_new_opmath

disable_new_opmath(warn=True)[source]

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

Parameters

warn (bool) – Whether or not to emit a warning for disabling new opmath. Default is True.

Example

>>> qml.operation.active_new_opmath()
True
>>> type(qml.X(0) @ qml.Z(1))
<class 'pennylane.ops.op_math.prod.Prod'>
>>> qml.operation.disable_new_opmath()
>>> type(qml.X(0) @ qml.Z(1))
<class 'pennylane.operation.Tensor'>