Skip to content

Commit

Permalink
Add iterator-access methods to SparseObservable (#13370)
Browse files Browse the repository at this point in the history
* Add iterator-access methods to `SparseObservable`

This adds a new related class, `SparseObservable.Term` to be the item
type of the iteration methods, and imbibes it with the simplest
mathematical binary relations with `SparseObservable` as the other
operand.

For some reason, in my head, the methods to convert terms and
observables to their corresponding Pauli basis are related to iteration?
The `SparseObservable.pauli_bases` and
`SparseObservable.Term.pauli_base` methods perform a similar bitwise
trick to do this reduction as exemplified in the documentation, but
return the other `quantum_info`-native classes `PauliList` and `Pauli`,
respectively.  These methods are expected to be used by the primitives.

* Improve documentation

* Return `SparseObservable` from sequence indices
  • Loading branch information
jakelishman authored Nov 5, 2024
1 parent 2efb59c commit c883c26
Show file tree
Hide file tree
Showing 2 changed files with 728 additions and 24 deletions.
Loading

0 comments on commit c883c26

Please sign in to comment.