Describe the feature you'd like
In v0.36.0 of PennyLane, the new LinearCombination is used in favour of the legacy Hamiltonian, which should also be supported as an observable.
Additional context
There are two classes now to represent a Hamiltonian: qml.ops.Hamiltonian, and qml.ops.LinearCombination. The latter is now used by default in favour of the former. With new opmath enabled, qml.Hamiltonian will refer to LinearCombination, and with new opmath disabled, qml.Hamiltonian will refer to the old Hamiltonian class.
Solution
In braket_device.py, line 169 should be updated to return base_observables.union({"Hamiltonian", "LinearCombination"})
Update all isinstance(..., Hamiltonian) checks to isinstance(..., (qml.ops.Hamiltonian, qml.ops.LinearCombination)), such as line 230 of braket_device.py, line 561 and 691 of translation.py
Describe the feature you'd like In v0.36.0 of PennyLane, the new
LinearCombination
is used in favour of the legacyHamiltonian
, which should also be supported as an observable.Additional context There are two classes now to represent a Hamiltonian:
qml.ops.Hamiltonian
, andqml.ops.LinearCombination
. The latter is now used by default in favour of the former. With new opmath enabled,qml.Hamiltonian
will refer toLinearCombination
, and with new opmath disabled,qml.Hamiltonian
will refer to the oldHamiltonian
class.Solution
braket_device.py
, line 169 should be updated toreturn base_observables.union({"Hamiltonian", "LinearCombination"})
isinstance(..., Hamiltonian)
checks toisinstance(..., (qml.ops.Hamiltonian, qml.ops.LinearCombination))
, such as line 230 ofbraket_device.py
, line 561 and 691 oftranslation.py
translation.py
to: