Shortcuts

qiskit.quantum_info.hellinger_fidelity

hellinger_fidelity(dist_p, dist_q)[소스]

Computes the Hellinger fidelity between two counts distributions.

The fidelity is defined as 1-H where H is the Hellinger distance. This value is bounded in the range [0, 1].

매개변수
  • dist_p (dict) – First dict of counts.

  • dist_q (dict) – Second dict of counts.

반환값

Fidelity

반환 형식

float

예제

from qiskit import QuantumCircuit, execute, BasicAer
from qiskit.quantum_info.analysis import hellinger_fidelity

qc = QuantumCircuit(5, 5)
qc.h(2)
qc.cx(2, 1)
qc.cx(2, 3)
qc.cx(3, 4)
qc.cx(1, 0)
qc.measure(range(5), range(5))

sim = BasicAer.get_backend('qasm_simulator')
res1 = execute(qc, sim).result()
res2 = execute(qc, sim).result()

hellinger_fidelity(res1.get_counts(), res2.get_counts())
1.0
당신은 다음 언어로 문서를 보고 있다 lang: Korean
언어
English
Japanese
German
Korean