Skip to content

ObservablesArray to be based on SparseObservable #14129

@yaelbh

Description

@yaelbh

In ObservablesArray , each item is a mapping from Pauli strings to coefficients. We want to replace this internal representation with objects of type SparseObservable.

  • Extend ObservableLike to include SparseObservable.
  • ObservablesArray and EstimatorPub will have a new Boolean member named allow_projections, whose default value will be False. Edit: not sure that we need it.
  • The method coerce_observable will take care that entries of ObservablesArrayLike._array will all be of type SparseObservable. It will also call SparseObservable.simplify for every observable, and raise an error if some of the observables contain projections and allow_projections is False.
  • The methods __array__, __getitem__, and tolist will return mappings, as today. Their alphabet will be extended to IXYZ01+-lr.
  • __repr__ will return the same string as it does now.
  • Write new methods get_sparse_observable(index) and sparse_observable_array, which will be the equivalents of __getitem__ and __array__, returning sparse observables instead of mappings.
  • Write a new method apply_layout, which will simply call apply_layout for every observable.
  • Make BackendEstimatorV2 and StatevectorEstimator support projections (this one is not for 2.1.0, and in fact deserves a separate issue).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions