Skip to content

Commit e007a85

Browse files
Simplify fc_tn
1 parent 4714829 commit e007a85

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

scripts/fc_tn_qiskit_validation.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,40 +73,31 @@ def bench_qrack(width, depth, sdrp):
7373
if len(ideal_probs) >= retained:
7474
break
7575

76-
numer = 0
77-
denom = 0
7876
for key in ideal_probs.keys():
79-
ideal = ideal_probs[key]
80-
adj = ideal / sum_probs
81-
ideal_probs[key] = adj
82-
denom += (ideal - u_u) ** 2
83-
numer += (ideal - u_u) * (adj - u_u)
84-
85-
adj_xeb = numer / denom
77+
ideal_probs[key] = ideal_probs[key] / sum_probs
8678

8779
rcs.save_statevector()
8880
control = AerSimulator(method="statevector")
8981
job = control.run(rcs)
9082
control_probs = Statevector(job.result().get_statevector()).probabilities()
9183

92-
return calc_stats(control_probs, ideal_probs, adj_xeb, shots, depth)
84+
return calc_stats(control_probs, ideal_probs, shots, depth)
9385

9486

95-
def calc_stats(ideal_probs, exp_probs, adj_xeb, shots, depth):
87+
def calc_stats(ideal_probs, exp_probs, shots, depth):
9688
# For QV, we compare probabilities of (ideal) "heavy outputs."
9789
# If the probability is above 2/3, the protocol certifies/passes the qubit width.
9890
n_pow = len(ideal_probs)
9991
mean_guess = 1 / n_pow
10092
n = int(round(math.log2(n_pow)))
10193
threshold = statistics.median(ideal_probs)
10294
u_u = statistics.mean(ideal_probs)
103-
model = min(1.0, 1 / (adj_xeb * n * n))
10495
numer = 0
10596
denom = 0
10697
sum_hog_counts = 0
10798
sqr_diff = 0
10899
for i in range(n_pow):
109-
exp = model * (exp_probs[i] if i in exp_probs else 0) + (1.0 - model) * mean_guess
100+
exp = exp_probs[i] if i in exp_probs else 0
110101
ideal = ideal_probs[i]
111102

112103
# XEB / EPLG

0 commit comments

Comments
 (0)