Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement arithmetic on
SparseObservable
The simple arithmetic operators of addition, subtraction, multiplication, division and tensor product are in line with other `quantum_info` objects, including coercion from other objects (though better behaved on failed coercions, in many cases). Where appopriate, in-place operations will re-use the existing allocations. The tensor product cannot really be done in place, so it doesn't define a special `__rxor__` operator, but it inherits the standard Python behaviour of this being derived from `__xor__`. There are further mathematical operations to add around composition and evolution, and to apply a `TranspileLayout` to the observable. All of these, in the `quantum_info` style either directly deal with a layout, or take a `qargs` argument that is effectively a sublayout for the right-hand side of the operation. These will be added in a follow-up.
- Loading branch information