Open kdk opened 1 year ago
expected_fidelities gives a deviation in the case of approximation_degree=0.0,
it gives a exp_fidelity=1
instead of 0 (with basis_fidelity=1).
Why is basis_fidelity=1
when approximation_degree=0.0?
The reason that basis_fidelity=1
could be that in class TwoQubitBasisDecomposer: basis_fidelity is default 1.
Args:
gate (Gate): Two-qubit gate to be used in the KAK decomposition.
basis_fidelity (float): Fidelity to be assumed for applications of KAK Gate. Default 1.0.
The values are
approx expr_fid
0 1.0
0.1 0.0010000000000000002
0.2 0.008000000000000002
0.3 0.026999999999999996
0.4 0.06400000000000002
0.5 0.125
0.6 0.21599999999999997
0.7 0.3429999999999999
0.8 0.5120000000000001
0.9 0.7290000000000001
1 1.0
Test code
ap_list = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
for ap in ap_list:
circ_10 = transpile(
circuit,
basis_gates=["u", "cx"],
translation_method="synthesis",
approximation_degree = ap,
)
As noted in #8595 and elsewhere, the transpiler currently mishandles
approximation_degree=0.0
asapproximation_degree=None
(which isapproximation_degree=1.0
). Following the definition ofapproximation_degree
here: https://github.com/Qiskit/qiskit-terra/blob/367ed4e34a3d662ef8ed8f2b91e8823bba1b8ca8/qiskit/compiler/transpiler.py#L178approximation_degree=0.0
should maximally approximate (however that is defined by the relevant pass). Currently, I think there's a bug in handlingapproximation_degree
IIRC in theTwoQubitBasisComposer
(by this point,basis_fidelity
)https://github.com/Qiskit/qiskit-terra/blob/dbc81a8dcdae9e9294b9058babf5883258daaa5d/qiskit/quantum_info/synthesis/two_qubit_decompose.py#L1087
that causes this, but this would need to be confirmed first.