Korbinian Kottmann
Korbinian Kottmann
> As a comment, I personally like to see that the code works as it is displayed or more frequently. It has been at the end of the demo when...
In this current form, this PR simply encapsulates copying all contents of `pennylane/ops/qubit/hamiltonian.py` and `tests/ops/qubit/test_hamiltonian.py` and renaming `Hamiltonian` -> `LinearCombination`. To get (almost) all tests to pass there were changes...
Updating `simplify` turns out a lot more complicated than I thought. Still a work in progress but the current version _mostly_ works, though it all feels a bit sketchy. The...
Found the culprit https://github.com/PennyLaneAI/pennylane/blob/master/pennylane/ops/op_math/sprod.py#L152 Fix attempt: https://github.com/PennyLaneAI/pennylane/pull/5246
Currently still having an issue with when multiplying integers with integers, e.g. `0 * qml.LinearCombination([1], [X(0)])` when either of the coefficients is turned to a float there is no issue...
Switched base to https://github.com/PennyLaneAI/pennylane/tree/enable_new_opmath All failing test are due to that switch in the base. The `tests/ops/op_math/test_linear_combination.py` pass
This current version is a heavy lean on Hamiltonian (basically started from there 1to1 and just changed whatever needed changing so the original tests would pass with new opmath enabled)....
> ``` > op = qml.ops.LinearCombination([1.1, 2.2], [qml.X(0), qml.Z(0)]) > op.diagonalizing_gates() > ``` > > ``` > IndexError: tuple index out of range > ``` > > Basically I think...
> One thing I was wondering, do we want to preserve the original PauliSentences in the basis, or can we build an equivalent orthonormal basis? Some operations may be simplified...
Non-urgent, but if you find the time to re-review this that would be great. I have been extensively using this and the follow-up PR with the actual lie closure (https://github.com/PennyLaneAI/pennylane/pull/5169)