qml.operation.convert_to_opmath

convert_to_opmath(op)[source]

Converts Hamiltonian and Tensor instances into arithmetic operators. Objects of any other type are returned directly.

Arithmetic operators include Prod, Sum and SProd.

Parameters

op (Operator) – The operator instance to convert

Returns

An operator using the new arithmetic operations, if relevant

Return type

Operator