Skip to content

Commit e196c6c

Browse files
author
Corey Ostrove
committed
Reenable support for predicted RB number
Reenable support for the predicted RB number table in the gauge invariant error metric section of the reports. This had previously been disabled, but I believe the version of the relevant function for computing this in the pyGSTi rbtheory tools module does work, so this reenables that computation using the newest code path.
1 parent 29b7dea commit e196c6c

File tree

5 files changed

+5
-18
lines changed

5 files changed

+5
-18
lines changed

pygsti/report/reportables.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,9 +2259,7 @@ def predicted_rb_number(model_a, model_b):
22592259
-------
22602260
float
22612261
"""
2262-
#TEMPORARILY disabled b/c RB analysis is broken
2263-
#from ..extras.rb import theory as _rbtheory
2264-
return -1.0 # _rbtheory.predicted_rb_number(model_a, model_b)
2262+
return _tools.rbtheory.predicted_rb_number(model_a, model_b)
22652263

22662264

22672265
Predicted_rb_number = _modf.modelfn_factory(predicted_rb_number)

pygsti/report/section/gauge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def final_model_eigenvalue_table(workspace, switchboard=None, confidence_level=N
5353
)
5454

5555
@_Section.figure_factory(4)
56-
def final_model_vs_target_table(workspace, switchboard=None, confidence_level=None, ci_brevity=1, **kwargs):
56+
def final_model_predicted_RB_table(workspace, switchboard=None, confidence_level=None, ci_brevity=1, **kwargs):
5757
return workspace.ModelVsTargetTable(
5858
switchboard.mdl_final, switchboard.mdl_target, switchboard.clifford_compilation,
5959
_cri(1, switchboard, confidence_level, ci_brevity)

pygsti/report/templates/standard_html_report/tabs/GaugeInvariants_gates.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<h1>Gauge Invariant Error Metrics</h1>
22
<p>GST can estimate gates <em>up to an overall gauge</em>. PyGSTi tries to find a good gauge in which to report process matrices and gauge-variant metrics like fidelity -- but sometimes this goes wrong. The most reliable error metrics and gate properties are <em>gauge-invariant</em> ones, and these are listed on this tab.</p>
33

4-
<figure id="final_model_vs_target_table" class='tbl'>
4+
<figure id="final_model_predicted_RB_table" class='tbl'>
55
<figcaption><span class="captiontitle">RB error metrics</span> <span class="captiondetail">This table shows estimates for the error rate that would be obtained using two different Randomized Benchmarking (RB) protocols . The Clifford RB number corresponds to the most standard form of RB, Clifford RB (CRB), where random Clifford gate sequences are performed. This number is dependent on how the Clifford operations are compiled into the primitive gates, and so if you didn't specify a Clifford compilation and pygsti couldn't deduce one, this quantity will be absent. Note that this is the error rate per-Clifford; it has not been rescaled to a per-primitive error rate. The primitive RB number corresponds to performing RB on random sequences of the primitive gates, rather than the Cliffords, which is known as <q>Direct RB</q> (DRB). DRB allows for sampling layers of primitives according to a general probability distribution over the primitive gates; the number reported here corresponds to uniformly sampling the primitive gates. This number does not require any compilation table and is always be computed by pyGSTi. Two caveats regarding these RB numbers: 1) The primitive RB number is not meaningful for arbitrary gate sets; if the gate set generates the Clifford group or it is a universal gate set then it is definitely meaningful, modulo the second caveat. 2) These predicted RB numbers rely on a perturbative technique, and if the estimated gates are far from their ideal counterparts the predicted numbers may be very inaccurate (and the empirical RB error rate itself may even be ill-defined: the RB decay could be non-exponential). For both of these RB protocols there is also more than one definition of the RB number, as a function of the p obtained from fitting RB data to <span class="math">A + Bp^m</span>. Here we use the definition <span class="math">r = (4^n - 1)(1-p)/4^n</span> for an n-qubit gate set, which means that <span class="math">r</span> = entanglement infidelity = 1/2 diamond distance if there are uniform depolarizing errors on all the gates (where these two quantities are w.r.t. the gate set benchmarked, so the Clifford gates for CRB and the primitive gates for DRB). For more general errors, these first two quantities will often be roughly equal, although that is not guaranteed. Note that these numbers should not be directly compared to RB numbers derived using the commonly-used alternative formula <span class="math">r = (2^n - 1)(1-p)/2^n</span> (which is related to average gate infidelity, rather than entanglement infidelity).</span></figcaption>
6-
{{ final_model_vs_target_table|render }}
6+
{{ final_model_predicted_RB_table|render }}
77
</figure>
88

99
<figure id="final_model_spam_parameters_table" class='tbl'>

pygsti/report/workspace.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import itertools as _itertools
1616
import os as _os
1717
import pickle as _pickle
18-
# import uuid as _uuid
1918
import random as _random
2019
import shutil as _shutil
2120
import subprocess as _subprocess

pygsti/report/workspacetables.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,23 +1151,13 @@ def _create(self, model, target_model, clifford_compilation, confidence_region_i
11511151
table = _ReportTable(colHeadings, formatters, col_heading_labels=tooltips,
11521152
confidence_region_info=confidence_region_info)
11531153

1154-
#Leave this off for now, as it's primary use is to compare with RB and the predicted RB number is better
1155-
#for this.
1156-
#pAGsI = _ev(_reportables.Average_gateset_infidelity(model, target_model), confidence_region_info)
1157-
#table.add_row(("Avg. primitive model infidelity", pAGsI), (None, 'Normal') )
1158-
11591154
pRBnum = _ev(_reportables.Predicted_rb_number(model, target_model), confidence_region_info)
11601155
table.add_row(("Predicted primitive RB number", pRBnum), (None, 'Normal'))
11611156

1162-
from pygsti.forwardsims import MatrixForwardSimulator as _MatrixFSim
1163-
if clifford_compilation and isinstance(model.sim, _MatrixFSim):
1157+
if clifford_compilation:
11641158
clifford_model = _models.create_explicit_alias_model(model, clifford_compilation)
11651159
clifford_targetModel = _models.create_explicit_alias_model(target_model, clifford_compilation)
11661160

1167-
##For clifford versions we don't have a confidence region - so no error bars
1168-
#AGsI = _ev(_reportables.Average_gateset_infidelity(clifford_model, clifford_targetModel))
1169-
#table.add_row(("Avg. clifford model infidelity", AGsI), (None, 'Normal') )
1170-
11711161
RBnum = _ev(_reportables.Predicted_rb_number(clifford_model, clifford_targetModel))
11721162
table.add_row(("Predicted Clifford RB number", RBnum), (None, 'Normal'))
11731163

0 commit comments

Comments
 (0)