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.

Parameters

op (Operator) – The operator instance to convert.

Returns

The operator as a Hamiltonian instance

Return type

Operator