qml.operation.convert_to_legacy_H

convert_to_legacy_H(op)[source]

Converts arithmetic operators into a legacy Hamiltonian instance. Objects of any other type are returned directly.

Arithmetic operators include Prod, Sum and SProd.

Warning

Using legacy operator arithmetic is deprecated, and will be removed in PennyLane v0.40. For further details, see Updated Operators.

Parameters

op (Operator) – The operator instance to convert.

Returns

The operator as a Hamiltonian instance

Return type

Operator