Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

BaseStateFidelity

class BaseStateFidelity

GitHub

Bases: abc.ABC

An interface to calculate state fidelities (state overlaps) for pairs of (parametrized) quantum circuits. The calculation depends on the particular fidelity method implementation, but can be always defined as the state overlap:

ψ(x)ϕ(y)2|\langle\psi(x)|\phi(y)\rangle|^2

where xx and yy are optional parametrizations of the states ψ\psi and ϕ\phi prepared by the circuits circuit_1 and circuit_2, respectively.


Methods

create_fidelity_circuit

abstract BaseStateFidelity.create_fidelity_circuit(circuit_1, circuit_2)

Implementation-dependent method to create a fidelity circuit from 2 circuit inputs.

Parameters

Return type

QuantumCircuit

Returns

The fidelity quantum circuit corresponding to circuit_1 and circuit_2.

run

BaseStateFidelity.run(circuits_1, circuits_2, values_1=None, values_2=None, **options)

Runs asynchronously the state overlap (fidelity) calculation between two (parametrized) circuits (first and second) for a specific set of parameter values (first and second). This calculation depends on the particular fidelity method implementation.

Parameters

  • circuits_1 – (Parametrized) quantum circuits preparing ψ|\psi\rangle.
  • circuits_2 – (Parametrized) quantum circuits preparing ϕ|\phi\rangle.
  • values_1 – Numerical parameters to be bound to the first set of circuits.
  • values_2 – Numerical parameters to be bound to the second set of circuits.
  • options – Primitive backend runtime options used for circuit execution. The order of priority is: options in run method > fidelity’s default options > primitive’s default setting. Higher priority setting overrides lower priority setting.

Returns

Primitive job for the fidelity calculation. The job’s result is an instance of StateFidelityResult.

Was this page helpful?
Report a bug or request content on GitHub.