Implement estimator interface#148
Open
jsaroni wants to merge 3 commits into
Open
Conversation
On using measurements to a quantum circuit.
1ucian0
reviewed
Jun 4, 2026
Co-authored-by: Luciano Bello <766693+1ucian0@users.noreply.github.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the estimator interface requested in issue #145 by adding the C++ counterpart of Qiskit's Python backend_estimator_v2.py. The implementation introduces the required interface methods within backend_estimator_v2.hpp in primitives, the
EstimatorPubin analogy to theSamplerPub, and supporting functionality to enable estimator-based workflows within the qiskit-cpp codebase. These changes are tested on real quantum hardware returning expectation values and associated standard deviations of a multi-term test observable, reconstructed from the run execution outcome distribution. The estimator.run() will accept anEstimatorPubandSamplerPubreturning the appropriate classes. TheEstimatorPubtakes ISA circuits and observables.Related issue
Closes #145
Changes made
EstimatorPubandSamplerPubframework.EstimatorPubtakes ISA circuits and observables (see https://quantum.cloud.ibm.com/docs/en/api/qiskit-ibm-runtime/estimator-v2)estimator.run() function will return BackendEstimatorJob class as well as BackendSamplerJob class (https://github.com/Qiskit/qiskit-cpp/blob/main/src/primitives/backend_sampler_job.hpp) containing estimation values and standard deviations.
Details, comments and testing
H = a * ZZ + 0.5 * XIwith respect to a maximally entangled state./estimator_testto get test output.AI assistance disclosure
GPT-5.5 helped inspect the function structure in backend_estimator_v2.hpp which I sourced from the Python Qiskit version backend_estimator_v2.py https://github.com/Qiskit/qiskit/blob/stable/2.4/qiskit/primitives/backend_estimator_v2.py#L170-L510, that I manually verified and tested.