mirror of https://github.com/Qiskit/qiskit.git
27 lines
1.0 KiB
YAML
27 lines
1.0 KiB
YAML
---
|
|
features:
|
|
- |
|
|
Added new algorithms to calculate state fidelities/overlaps
|
|
for pairs of quantum circuits (that can be parametrized). Apart from
|
|
the base class (:class:`~qiskit.algorithms.state_fidelities.BaseStateFidelity`) which defines the interface,
|
|
there is an implementation of the compute-uncompute method that leverages
|
|
instances of the :class:`~.BaseSampler` primitive: :class:`qiskit.algorithms.state_fidelities.ComputeUncompute`.
|
|
|
|
For example:
|
|
|
|
.. code-block:: python
|
|
|
|
import numpy as np
|
|
from qiskit.primitives import Sampler
|
|
from qiskit.algorithms.state_fidelities import ComputeUncompute
|
|
from qiskit.circuit.library import RealAmplitudes
|
|
|
|
sampler = Sampler(...)
|
|
fidelity = ComputeUncompute(sampler)
|
|
circuit = RealAmplitudes(2)
|
|
values = np.random.random(circuit.num_parameters)
|
|
shift = np.ones_like(values) * 0.01
|
|
|
|
job = fidelity.run([circuit], [circuit], [values], [values+shift])
|
|
fidelities = job.result().fidelities
|