estimate_expectation
fireopal.estimate_expectation(circuits, shot_count, credentials, backend_name, observables, parameters=None, run_options=None)Estimate expectation values of observables for quantum circuits.
Use this function to compute the expectation value of one or more observables for a batch of quantum circuits executed on a specified backend. Fire Opal automatically applies error suppression and mitigation to improve the accuracy of the estimated expectation values.
Parameters
- circuits (str or list [ str ]) – Quantum circuit(s) as QASM 2.0 or 3.0 strings. Convert Qiskit
QuantumCircuitobjects usingqiskit.qasm2.dumpsorqiskit.qasm3.dumps. - shot_count (int) – Number of bitstrings sampled from the final quantum state of each circuit.
- credentials (Credentials) – Credentials for the target hardware provider, created using the
appropriate helper from the
fireopal.credentialsmodule. For example, usemake_credentials_for_ibm_cloud()for IBM backends. - backend_name (str) – Name of the backend that will execute circuits.
- observables (PauliOperator or list [PauliOperator ] or str or list [ str ] or dict [ str , float ] or list [ tuple [ str , float ] ]) – Observable(s) for which to compute expectation values. Accepts Pauli
strings (for example,
"ZZI"), weighted dictionaries (for example,{"ZZI": 0.5, "IZZ": 0.5}), orPauliOperatorinstances. - parameters (dict [ str , float ] or list [ dict [ str , float ] ] or None , optional) – Parameter bindings for parametric circuit(s). Each dictionary maps parameter names to float values. Provide a list when submitting multiple circuits with distinct bindings. Defaults to None.
- run_options (RunOptions or None , optional) – Provider-specific execution options, for example,
IbmRunOptions). See thefireopal.run_optionsmodule for available classes. Defaults to None.
Returns
FireOpalJob – A job object whose result() method returns a dictionary
containing:
expectation_values (list[float]): The estimated expectation values of the observables for each circuit.
standard_deviations (list[float]): The standard deviations of the estimated expectation values, accounting for shot noise.