pyGSTi 0.9.12.1__cp39-cp39-win32.whl → 0.9.13__cp39-cp39-win32.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (221) hide show
  1. pyGSTi-0.9.13.dist-info/METADATA +197 -0
  2. {pyGSTi-0.9.12.1.dist-info → pyGSTi-0.9.13.dist-info}/RECORD +207 -217
  3. {pyGSTi-0.9.12.1.dist-info → pyGSTi-0.9.13.dist-info}/WHEEL +1 -1
  4. pygsti/_version.py +2 -2
  5. pygsti/algorithms/contract.py +1 -1
  6. pygsti/algorithms/core.py +42 -28
  7. pygsti/algorithms/fiducialselection.py +17 -8
  8. pygsti/algorithms/gaugeopt.py +2 -2
  9. pygsti/algorithms/germselection.py +87 -77
  10. pygsti/algorithms/mirroring.py +0 -388
  11. pygsti/algorithms/randomcircuit.py +165 -1333
  12. pygsti/algorithms/rbfit.py +0 -234
  13. pygsti/baseobjs/basis.py +94 -396
  14. pygsti/baseobjs/errorgenbasis.py +0 -132
  15. pygsti/baseobjs/errorgenspace.py +0 -10
  16. pygsti/baseobjs/label.py +52 -168
  17. pygsti/baseobjs/opcalc/fastopcalc.cp39-win32.pyd +0 -0
  18. pygsti/baseobjs/opcalc/fastopcalc.pyx +2 -2
  19. pygsti/baseobjs/polynomial.py +13 -595
  20. pygsti/baseobjs/statespace.py +1 -0
  21. pygsti/circuits/__init__.py +1 -1
  22. pygsti/circuits/circuit.py +682 -505
  23. pygsti/circuits/circuitconstruction.py +0 -4
  24. pygsti/circuits/circuitlist.py +47 -5
  25. pygsti/circuits/circuitparser/__init__.py +8 -8
  26. pygsti/circuits/circuitparser/fastcircuitparser.cp39-win32.pyd +0 -0
  27. pygsti/circuits/circuitstructure.py +3 -3
  28. pygsti/circuits/cloudcircuitconstruction.py +1 -1
  29. pygsti/data/datacomparator.py +2 -7
  30. pygsti/data/dataset.py +46 -44
  31. pygsti/data/hypothesistest.py +0 -7
  32. pygsti/drivers/bootstrap.py +0 -49
  33. pygsti/drivers/longsequence.py +2 -1
  34. pygsti/evotypes/basereps_cython.cp39-win32.pyd +0 -0
  35. pygsti/evotypes/chp/opreps.py +0 -61
  36. pygsti/evotypes/chp/statereps.py +0 -32
  37. pygsti/evotypes/densitymx/effectcreps.cpp +9 -10
  38. pygsti/evotypes/densitymx/effectreps.cp39-win32.pyd +0 -0
  39. pygsti/evotypes/densitymx/effectreps.pyx +1 -1
  40. pygsti/evotypes/densitymx/opreps.cp39-win32.pyd +0 -0
  41. pygsti/evotypes/densitymx/opreps.pyx +2 -2
  42. pygsti/evotypes/densitymx/statereps.cp39-win32.pyd +0 -0
  43. pygsti/evotypes/densitymx/statereps.pyx +1 -1
  44. pygsti/evotypes/densitymx_slow/effectreps.py +7 -23
  45. pygsti/evotypes/densitymx_slow/opreps.py +16 -23
  46. pygsti/evotypes/densitymx_slow/statereps.py +10 -3
  47. pygsti/evotypes/evotype.py +39 -2
  48. pygsti/evotypes/stabilizer/effectreps.cp39-win32.pyd +0 -0
  49. pygsti/evotypes/stabilizer/effectreps.pyx +0 -4
  50. pygsti/evotypes/stabilizer/opreps.cp39-win32.pyd +0 -0
  51. pygsti/evotypes/stabilizer/opreps.pyx +0 -4
  52. pygsti/evotypes/stabilizer/statereps.cp39-win32.pyd +0 -0
  53. pygsti/evotypes/stabilizer/statereps.pyx +1 -5
  54. pygsti/evotypes/stabilizer/termreps.cp39-win32.pyd +0 -0
  55. pygsti/evotypes/stabilizer/termreps.pyx +0 -7
  56. pygsti/evotypes/stabilizer_slow/effectreps.py +0 -22
  57. pygsti/evotypes/stabilizer_slow/opreps.py +0 -4
  58. pygsti/evotypes/stabilizer_slow/statereps.py +0 -4
  59. pygsti/evotypes/statevec/effectreps.cp39-win32.pyd +0 -0
  60. pygsti/evotypes/statevec/effectreps.pyx +1 -1
  61. pygsti/evotypes/statevec/opreps.cp39-win32.pyd +0 -0
  62. pygsti/evotypes/statevec/opreps.pyx +2 -2
  63. pygsti/evotypes/statevec/statereps.cp39-win32.pyd +0 -0
  64. pygsti/evotypes/statevec/statereps.pyx +1 -1
  65. pygsti/evotypes/statevec/termreps.cp39-win32.pyd +0 -0
  66. pygsti/evotypes/statevec/termreps.pyx +0 -7
  67. pygsti/evotypes/statevec_slow/effectreps.py +0 -3
  68. pygsti/evotypes/statevec_slow/opreps.py +0 -5
  69. pygsti/extras/__init__.py +0 -1
  70. pygsti/extras/drift/stabilityanalyzer.py +3 -1
  71. pygsti/extras/interpygate/__init__.py +12 -0
  72. pygsti/extras/interpygate/core.py +0 -36
  73. pygsti/extras/interpygate/process_tomography.py +44 -10
  74. pygsti/extras/rpe/rpeconstruction.py +0 -2
  75. pygsti/forwardsims/__init__.py +1 -0
  76. pygsti/forwardsims/forwardsim.py +14 -55
  77. pygsti/forwardsims/mapforwardsim.py +69 -18
  78. pygsti/forwardsims/mapforwardsim_calc_densitymx.cp39-win32.pyd +0 -0
  79. pygsti/forwardsims/mapforwardsim_calc_densitymx.pyx +65 -66
  80. pygsti/forwardsims/mapforwardsim_calc_generic.py +91 -13
  81. pygsti/forwardsims/matrixforwardsim.py +63 -15
  82. pygsti/forwardsims/termforwardsim.py +8 -110
  83. pygsti/forwardsims/termforwardsim_calc_stabilizer.cp39-win32.pyd +0 -0
  84. pygsti/forwardsims/termforwardsim_calc_statevec.cp39-win32.pyd +0 -0
  85. pygsti/forwardsims/termforwardsim_calc_statevec.pyx +0 -651
  86. pygsti/forwardsims/torchfwdsim.py +265 -0
  87. pygsti/forwardsims/weakforwardsim.py +2 -2
  88. pygsti/io/__init__.py +1 -2
  89. pygsti/io/mongodb.py +0 -2
  90. pygsti/io/stdinput.py +6 -22
  91. pygsti/layouts/copalayout.py +10 -12
  92. pygsti/layouts/distlayout.py +0 -40
  93. pygsti/layouts/maplayout.py +103 -25
  94. pygsti/layouts/matrixlayout.py +99 -60
  95. pygsti/layouts/prefixtable.py +1534 -52
  96. pygsti/layouts/termlayout.py +1 -1
  97. pygsti/modelmembers/instruments/instrument.py +3 -3
  98. pygsti/modelmembers/instruments/tpinstrument.py +2 -2
  99. pygsti/modelmembers/modelmember.py +0 -17
  100. pygsti/modelmembers/operations/__init__.py +2 -4
  101. pygsti/modelmembers/operations/affineshiftop.py +1 -0
  102. pygsti/modelmembers/operations/composederrorgen.py +1 -1
  103. pygsti/modelmembers/operations/composedop.py +1 -24
  104. pygsti/modelmembers/operations/denseop.py +5 -5
  105. pygsti/modelmembers/operations/eigpdenseop.py +2 -2
  106. pygsti/modelmembers/operations/embeddederrorgen.py +1 -1
  107. pygsti/modelmembers/operations/embeddedop.py +0 -1
  108. pygsti/modelmembers/operations/experrorgenop.py +2 -2
  109. pygsti/modelmembers/operations/fullarbitraryop.py +1 -0
  110. pygsti/modelmembers/operations/fullcptpop.py +2 -2
  111. pygsti/modelmembers/operations/fulltpop.py +28 -6
  112. pygsti/modelmembers/operations/fullunitaryop.py +5 -4
  113. pygsti/modelmembers/operations/lindbladcoefficients.py +93 -78
  114. pygsti/modelmembers/operations/lindbladerrorgen.py +268 -441
  115. pygsti/modelmembers/operations/linearop.py +7 -27
  116. pygsti/modelmembers/operations/opfactory.py +1 -1
  117. pygsti/modelmembers/operations/repeatedop.py +1 -24
  118. pygsti/modelmembers/operations/staticstdop.py +1 -1
  119. pygsti/modelmembers/povms/__init__.py +3 -3
  120. pygsti/modelmembers/povms/basepovm.py +7 -36
  121. pygsti/modelmembers/povms/complementeffect.py +4 -9
  122. pygsti/modelmembers/povms/composedeffect.py +0 -320
  123. pygsti/modelmembers/povms/computationaleffect.py +1 -1
  124. pygsti/modelmembers/povms/computationalpovm.py +3 -1
  125. pygsti/modelmembers/povms/effect.py +3 -5
  126. pygsti/modelmembers/povms/marginalizedpovm.py +0 -79
  127. pygsti/modelmembers/povms/tppovm.py +74 -2
  128. pygsti/modelmembers/states/__init__.py +2 -5
  129. pygsti/modelmembers/states/composedstate.py +0 -317
  130. pygsti/modelmembers/states/computationalstate.py +3 -3
  131. pygsti/modelmembers/states/cptpstate.py +4 -4
  132. pygsti/modelmembers/states/densestate.py +6 -4
  133. pygsti/modelmembers/states/fullpurestate.py +0 -24
  134. pygsti/modelmembers/states/purestate.py +1 -1
  135. pygsti/modelmembers/states/state.py +5 -6
  136. pygsti/modelmembers/states/tpstate.py +28 -10
  137. pygsti/modelmembers/term.py +3 -6
  138. pygsti/modelmembers/torchable.py +50 -0
  139. pygsti/modelpacks/_modelpack.py +1 -1
  140. pygsti/modelpacks/smq1Q_ZN.py +3 -1
  141. pygsti/modelpacks/smq2Q_XXYYII.py +2 -1
  142. pygsti/modelpacks/smq2Q_XY.py +3 -3
  143. pygsti/modelpacks/smq2Q_XYI.py +2 -2
  144. pygsti/modelpacks/smq2Q_XYICNOT.py +3 -3
  145. pygsti/modelpacks/smq2Q_XYICPHASE.py +3 -3
  146. pygsti/modelpacks/smq2Q_XYXX.py +1 -1
  147. pygsti/modelpacks/smq2Q_XYZICNOT.py +3 -3
  148. pygsti/modelpacks/smq2Q_XYZZ.py +1 -1
  149. pygsti/modelpacks/stdtarget.py +0 -121
  150. pygsti/models/cloudnoisemodel.py +1 -2
  151. pygsti/models/explicitcalc.py +3 -3
  152. pygsti/models/explicitmodel.py +3 -13
  153. pygsti/models/fogistore.py +5 -3
  154. pygsti/models/localnoisemodel.py +1 -2
  155. pygsti/models/memberdict.py +0 -12
  156. pygsti/models/model.py +800 -65
  157. pygsti/models/modelconstruction.py +4 -4
  158. pygsti/models/modelnoise.py +2 -2
  159. pygsti/models/modelparaminterposer.py +1 -1
  160. pygsti/models/oplessmodel.py +1 -1
  161. pygsti/models/qutrit.py +15 -14
  162. pygsti/objectivefns/objectivefns.py +73 -138
  163. pygsti/objectivefns/wildcardbudget.py +2 -7
  164. pygsti/optimize/__init__.py +1 -0
  165. pygsti/optimize/arraysinterface.py +28 -0
  166. pygsti/optimize/customcg.py +0 -12
  167. pygsti/optimize/customlm.py +129 -323
  168. pygsti/optimize/customsolve.py +2 -2
  169. pygsti/optimize/optimize.py +0 -84
  170. pygsti/optimize/simplerlm.py +841 -0
  171. pygsti/optimize/wildcardopt.py +19 -598
  172. pygsti/protocols/confidenceregionfactory.py +28 -14
  173. pygsti/protocols/estimate.py +31 -14
  174. pygsti/protocols/gst.py +142 -68
  175. pygsti/protocols/modeltest.py +6 -10
  176. pygsti/protocols/protocol.py +9 -37
  177. pygsti/protocols/rb.py +450 -79
  178. pygsti/protocols/treenode.py +8 -2
  179. pygsti/protocols/vb.py +108 -206
  180. pygsti/protocols/vbdataframe.py +1 -1
  181. pygsti/report/factory.py +0 -15
  182. pygsti/report/fogidiagram.py +1 -17
  183. pygsti/report/modelfunction.py +12 -3
  184. pygsti/report/mpl_colormaps.py +1 -1
  185. pygsti/report/plothelpers.py +8 -2
  186. pygsti/report/reportables.py +41 -37
  187. pygsti/report/templates/offline/pygsti_dashboard.css +6 -0
  188. pygsti/report/templates/offline/pygsti_dashboard.js +12 -0
  189. pygsti/report/workspace.py +2 -14
  190. pygsti/report/workspaceplots.py +326 -504
  191. pygsti/tools/basistools.py +9 -36
  192. pygsti/tools/edesigntools.py +124 -96
  193. pygsti/tools/fastcalc.cp39-win32.pyd +0 -0
  194. pygsti/tools/fastcalc.pyx +35 -81
  195. pygsti/tools/internalgates.py +151 -15
  196. pygsti/tools/jamiolkowski.py +5 -5
  197. pygsti/tools/lindbladtools.py +19 -11
  198. pygsti/tools/listtools.py +0 -114
  199. pygsti/tools/matrixmod2.py +1 -1
  200. pygsti/tools/matrixtools.py +173 -339
  201. pygsti/tools/nameddict.py +1 -1
  202. pygsti/tools/optools.py +154 -88
  203. pygsti/tools/pdftools.py +0 -25
  204. pygsti/tools/rbtheory.py +3 -320
  205. pygsti/tools/slicetools.py +64 -12
  206. pyGSTi-0.9.12.1.dist-info/METADATA +0 -155
  207. pygsti/algorithms/directx.py +0 -711
  208. pygsti/evotypes/qibo/__init__.py +0 -33
  209. pygsti/evotypes/qibo/effectreps.py +0 -78
  210. pygsti/evotypes/qibo/opreps.py +0 -376
  211. pygsti/evotypes/qibo/povmreps.py +0 -98
  212. pygsti/evotypes/qibo/statereps.py +0 -174
  213. pygsti/extras/rb/__init__.py +0 -13
  214. pygsti/extras/rb/benchmarker.py +0 -957
  215. pygsti/extras/rb/dataset.py +0 -378
  216. pygsti/extras/rb/io.py +0 -814
  217. pygsti/extras/rb/simulate.py +0 -1020
  218. pygsti/io/legacyio.py +0 -385
  219. pygsti/modelmembers/povms/denseeffect.py +0 -142
  220. {pyGSTi-0.9.12.1.dist-info → pyGSTi-0.9.13.dist-info}/LICENSE +0 -0
  221. {pyGSTi-0.9.12.1.dist-info → pyGSTi-0.9.13.dist-info}/top_level.txt +0 -0
pygsti/tools/rbtheory.py CHANGED
@@ -218,7 +218,8 @@ def rb_gauge(model, target_model, weights=None, mx_basis=None, eigenvector_weigh
218
218
  vec_l_operator = vec_l_operator.real
219
219
 
220
220
  vec_l_operator[abs(vec_l_operator) < 10**(-15)] = 0.
221
- l_operator = _mtls.unvec(vec_l_operator)
221
+ dim = int(_np.sqrt(vec_l_operator.size))
222
+ l_operator = vec_l_operator.reshape((dim, dim), order='F')
222
223
 
223
224
  return l_operator
224
225
 
@@ -457,255 +458,6 @@ def R_matrix(model, group, group_to_model=None, weights=None): # noqa N802
457
458
 
458
459
  return R
459
460
 
460
- ### COMMENTED OUT SO THAT THIS FILE DOESN'T NEED "from .. import construction as _cnst".
461
- ### THIS SHOULD BE ADDED BACK IN AT SOME POINT.
462
- # def exact_rb_asps(model, group, m_max, m_min=0, m_step=1, success_outcomelabel=('0',),
463
- # group_to_model=None, weights=None, compilation=None, group_twirled=False):
464
- # """
465
- # Calculates the exact RB average success probablilites (ASP).
466
-
467
- # Uses some generalizations of the formula given Proctor et al
468
- # Phys. Rev. Lett. 119, 130502 (2017). This formula does not scale well with
469
- # group size and qubit number, and for the Clifford group it is likely only
470
- # practical for a single qubit.
471
-
472
- # Parameters
473
- # ----------
474
- # model : Model
475
- # The noisy model (e.g., the Cliffords) to calculate the R matrix of.
476
- # The correpsonding `target` model (not required in this function)
477
- # must be equal to or a subset of (a faithful rep of) the group `group`.
478
- # If group_to_model is None, the labels of the gates in model should be
479
- # the same as the labels of the corresponding group elements in `group`.
480
- # For Clifford RB `model` should be the clifford model; for direct RB
481
- # this should be the native model.
482
-
483
- # group : MatrixGroup
484
- # The group that the `model` model contains gates from. For Clifford RB
485
- # or direct RB, this would be the Clifford group.
486
-
487
- # m_max : int
488
- # The maximal sequence length of the random gates, not including the
489
- # inversion gate.
490
-
491
- # m_min : int, optional
492
- # The minimal sequence length. Defaults to the smallest valid value of 0.
493
-
494
- # m_step : int, optional
495
- # The step size between sequence lengths. Defaults to the smallest valid
496
- # value of 1.
497
-
498
- # success_outcomelabel : str or tuple, optional
499
- # The outcome label associated with success.
500
-
501
- # group_to_model : dict, optional
502
- # If not None, a dictionary that maps labels of group elements to labels
503
- # of model. This is required if the labels of the gates in `model` are different
504
- # from the labels of the corresponding group elements in `group`.
505
-
506
- # weights : dict, optional
507
- # If not None, a dictionary of floats, whereby the keys are the gates in model
508
- # and the values are the unnormalized probabilities to apply each gate at
509
- # for each layer of the RB protocol. If None, the weighting defaults to an
510
- # equal weighting on all gates, as used in most RB protocols (e.g., Clifford
511
- # RB).
512
-
513
- # compilation : dict, optional
514
- # If `model` is not the full group `group` (with the same labels), then a
515
- # compilation for the group elements, used to implement the inversion gate
516
- # (and the initial randomgroup element, if `group_twirled` is True). This
517
- # is a dictionary with the group labels as keys and a gate sequence of the
518
- # elements of `model` as values.
519
-
520
- # group_twirled : bool, optional
521
- # If True, the random sequence starts with a single uniformly random group
522
- # element before the m random elements of `model`.
523
-
524
- # Returns
525
- # -------
526
- # m : float
527
- # Array of sequence length values that the ASPs have been calculated for.
528
-
529
- # P_m : float
530
- # Array containing ASP values for the specified sequence length values.
531
- # """
532
- # if compilation is None:
533
- # for key in list(model.operations.keys()):
534
- # assert(key in group.labels), "Gates labels are not in `group`, so `compilation must be specified."
535
- # for label in group.labels:
536
- # assert(label in list(model.operations.keys())
537
- # ), "Some group elements not in `model`, so `compilation must be specified."
538
-
539
- # i_max = _np.floor((m_max - m_min) / m_step).astype('int')
540
- # m = _np.zeros(1 + i_max, _np.int64)
541
- # P_m = _np.zeros(1 + i_max, float)
542
- # group_dim = len(group)
543
- # R = R_matrix(model, group, group_to_model=group_to_model, weights=weights)
544
- # success_prepLabel = list(model.preps.keys())[0] # just take first prep
545
- # success_effectLabel = success_outcomelabel[-1] if isinstance(success_outcomelabel, tuple) \
546
- # else success_outcomelabel
547
- # extended_E = _np.kron(_mtls.column_basis_vector(0, group_dim).T, model.povms['Mdefault'][success_effectLabel].T)
548
- # extended_rho = _np.kron(_mtls.column_basis_vector(0, group_dim), model.preps[success_prepLabel])
549
-
550
- # if compilation is None:
551
- # extended_E = group_dim * _np.dot(extended_E, R)
552
- # if group_twirled is True:
553
- # extended_rho = _np.dot(R, extended_rho)
554
- # else:
555
- # full_model = _cnst.create_explicit_alias_model(model, compilation)
556
- # R_fullgroup = R_matrix(full_model, group)
557
- # extended_E = group_dim * _np.dot(extended_E, R_fullgroup)
558
- # if group_twirled is True:
559
- # extended_rho = _np.dot(R_fullgroup, extended_rho)
560
-
561
- # Rstep = _np.linalg.matrix_power(R, m_step)
562
- # Riterate = _np.linalg.matrix_power(R, m_min)
563
- # for i in range(0, 1 + i_max):
564
- # m[i] = m_min + i * m_step
565
- # P_m[i] = _np.dot(extended_E, _np.dot(Riterate, extended_rho))
566
- # Riterate = _np.dot(Rstep, Riterate)
567
-
568
- # return m, P_m
569
-
570
- ### COMMENTED OUT SO THAT THIS FILE DOESN'T NEED "from .. import construction as _cnst"
571
- ### THIS SHOULD BE ADDED BACK IN AT SOME POINT.
572
- # def L_matrix_asps(model, target_model, m_max, m_min=0, m_step=1, success_outcomelabel=('0',), # noqa N802
573
- # compilation=None, group_twirled=False, weights=None, gauge_optimize=True,
574
- # return_error_bounds=False, norm='diamond'):
575
- # """
576
- # Computes RB average survival probablities, as predicted by the 'L-matrix' theory.
577
-
578
- # This theory was introduced in Proctor et al Phys. Rev. Lett. 119, 130502
579
- # (2017). Within the function, the model is gauge-optimized to target_model. This is
580
- # *not* optimized to the gauge specified by Proctor et al, but instead performs the
581
- # standard pyGSTi gauge-optimization (using the frobenius distance). In most cases,
582
- # this is likely to be a reasonable proxy for the gauge optimization perscribed by
583
- # Proctor et al.
584
-
585
- # Parameters
586
- # ----------
587
- # model : Model
588
- # The noisy model.
589
-
590
- # target_model : Model
591
- # The target model.
592
-
593
- # m_max : int
594
- # The maximal sequence length of the random gates, not including the inversion gate.
595
-
596
- # m_min : int, optional
597
- # The minimal sequence length. Defaults to the smallest valid value of 0.
598
-
599
- # m_step : int, optional
600
- # The step size between sequence lengths.
601
-
602
- # success_outcomelabel : str or tuple, optional
603
- # The outcome label associated with success.
604
-
605
- # compilation : dict, optional
606
- # If `model` is not the full group, then a compilation for the group elements,
607
- # used to implement the inversion gate (and the initial random group element,
608
- # if `group_twirled` is True). This is a dictionary with the group labels as
609
- # keys and a gate sequence of the elements of `model` as values.
610
-
611
- # group_twirled : bool, optional
612
- # If True, the random sequence starts with a single uniformly random group
613
- # element before the m random elements of `model`.
614
-
615
- # weights : dict, optional
616
- # If not None, a dictionary of floats, whereby the keys are the gates in model
617
- # and the values are the unnormalized probabilities to apply each gate at
618
- # for each layer of the RB protocol. If None, the weighting defaults to an
619
- # equal weighting on all gates, as used in most RB protocols (e.g., Clifford
620
- # RB).
621
-
622
- # gauge_optimize : bool, optional
623
- # If True a gauge-optimization to the target model is implemented before
624
- # calculating all quantities. If False, no gauge optimization is performed.
625
- # Whether or not a gauge optimization is performed does not affect the rate of
626
- # decay but it will generally affect the exact form of the decay. E.g., if a
627
- # perfect model is given to the function -- but in the "wrong" gauge -- no
628
- # decay will be observed in the output P_m, but the P_m can be far from 1 (even
629
- # for perfect SPAM) for all m. The gauge optimization is optional, as it is
630
- # not guaranteed to always improve the accuracy of the reported P_m, although when
631
- # gauge optimization is performed this limits the possible deviations of the
632
- # reported P_m from the true P_m.
633
-
634
- # return_error_bounds : bool, optional
635
- # Sets whether or not to return error bounds for how far the true ASPs can deviate
636
- # from the values returned by this function.
637
-
638
- # norm : str, optional
639
- # The norm used in the error bound calculation. Either 'diamond' for the diamond
640
- # norm (the default) or '1to1' for the Hermitian 1 to 1 norm.
641
-
642
- # Returns
643
- # -------
644
- # m : float
645
- # Array of sequence length values that the ASPs have been calculated for.
646
- # P_m : float
647
- # Array containing predicted ASP values for the specified sequence length values.
648
- # if error_bounds is True :
649
- # lower_bound: float
650
- # Array containing lower bounds on the possible ASP values
651
-
652
- # upper_bound: float
653
- # Array containing upper bounds on the possible ASP values
654
- # """
655
- # d = int(round(_np.sqrt(model.dim)))
656
-
657
- # if gauge_optimize:
658
- # model_go = _algs.gaugeopt_to_target(model, target_model)
659
- # else:
660
- # model_go = model.copy()
661
- # L = L_matrix(model_go, target_model, weights=weights)
662
- # success_prepLabel = list(model.preps.keys())[0] # just take first prep
663
- # success_effectLabel = success_outcomelabel[-1] if isinstance(success_outcomelabel, tuple) \
664
- # else success_outcomelabel
665
- # identity_vec = _mtls.vec(_np.identity(d**2, float))
666
-
667
- # if compilation is not None:
668
- # model_group = _cnst.create_explicit_alias_model(model_go, compilation)
669
- # model_target_group = _cnst.create_explicit_alias_model(target_model, compilation)
670
- # delta = gate_dependence_of_errormaps(model_group, model_target_group, norm=norm)
671
- # emaps = errormaps(model_group, model_target_group)
672
- # E_eff = _np.dot(model_go.povms['Mdefault'][success_effectLabel].T, emaps.operations['Gavg'])
673
-
674
- # if group_twirled is True:
675
- # L_group = L_matrix(model_group, model_target_group)
676
-
677
- # if compilation is None:
678
- # delta = gate_dependence_of_errormaps(model_go, target_model, norm=norm)
679
- # emaps = errormaps(model_go, target_model)
680
- # E_eff = _np.dot(model_go.povms['Mdefault'][success_effectLabel].T, emaps.operations['Gavg'])
681
-
682
- # i_max = _np.floor((m_max - m_min) / m_step).astype('int')
683
- # m = _np.zeros(1 + i_max, _np.int64)
684
- # P_m = _np.zeros(1 + i_max, float)
685
- # upper_bound = _np.zeros(1 + i_max, float)
686
- # lower_bound = _np.zeros(1 + i_max, float)
687
-
688
- # Lstep = _np.linalg.matrix_power(L, m_step)
689
- # Literate = _np.linalg.matrix_power(L, m_min)
690
- # for i in range(0, 1 + i_max):
691
- # m[i] = m_min + i * m_step
692
- # if group_twirled:
693
- # L_m_rdd = _mtls.unvec(_np.dot(L_group, _np.dot(Literate, identity_vec)))
694
- # else:
695
- # L_m_rdd = _mtls.unvec(_np.dot(Literate, identity_vec))
696
- # P_m[i] = _np.dot(E_eff, _np.dot(L_m_rdd, model_go.preps[success_prepLabel]))
697
- # Literate = _np.dot(Lstep, Literate)
698
- # upper_bound[i] = P_m[i] + delta / 2
699
- # lower_bound[i] = P_m[i] - delta / 2
700
- # if upper_bound[i] > 1:
701
- # upper_bound[i] = 1.
702
- # if lower_bound[i] < 0:
703
- # lower_bound[i] = 0.
704
- # if return_error_bounds:
705
- # return m, P_m, lower_bound, upper_bound
706
- # else:
707
- # return m, P_m
708
-
709
461
 
710
462
  def errormaps(model, target_model):
711
463
  """
@@ -791,78 +543,9 @@ def gate_dependence_of_errormaps(model, target_model, norm='diamond', mx_basis=N
791
543
  mx_basis=mx_basis))
792
544
  elif norm == '1to1':
793
545
  gate_dif = error_gs.operations[gate] - error_gs.operations['Gavg']
794
- delta.append(_optls.norm1to1(gate_dif, num_samples=1000, mx_basis=mx_basis, return_list=False))
546
+ delta.append(_optls.norm1to1(gate_dif, num_samples=1000, mx_basis=mx_basis))
795
547
  else:
796
548
  raise ValueError("Only diamond or 1to1 norm available.")
797
549
 
798
550
  delta_avg = _np.mean(delta)
799
551
  return delta_avg
800
-
801
- # Future : perhaps put these back in.
802
- #def Magesan_theory_predicted_decay(model, target_model, mlist, success_outcomelabel=('0',),
803
- # norm='1to1', order='zeroth', return_all = False):
804
- #
805
- # assert(order == 'zeroth' or order == 'first')
806
- #
807
- # d = int(round(_np.sqrt(model.dim)))
808
- # MTPs = {}
809
- # MTPs['r'] = gateset_infidelity(model,target_model,itype='AGI')
810
- # MTPs['p'] = _analysis.r_to_p(MTPs['r'],d,rtype='AGI')
811
- # MTPs['delta'] = gate_dependence_of_errormaps(model, target_model, norm)
812
- # error_gs = errormaps(model, target_model)
813
- #
814
- # R_list = []
815
- # Q_list = []
816
- # for gate in list(target_model.operations.keys()):
817
- # R_list.append(_np.dot(_np.dot(error_gs.operations[gate],target_model.operations[gate]),
818
- # _np.dot(error_gs.operations['Gavg'],_np.transpose(target_model.operations[gate]))))
819
- # Q_list.append(_np.dot(target_model.operations[gate],
820
- # _np.dot(error_gs.operations[gate],_np.transpose(target_model.operations[gate]))))
821
- #
822
- # error_gs.operations['GR'] = _np.mean(_np.array([ i for i in R_list]),axis=0)
823
- # error_gs.operations['GQ'] = _np.mean(_np.array([ i for i in Q_list]),axis=0)
824
- # error_gs.operations['GQ2'] = _np.dot(error_gs.operations['GQ'],error_gs.operations['Gavg'])
825
- # error_gs.preps['rhoc_mixed'] = 1./d*_cnst.create_identity_vec(error_gs.basis)#
826
- #
827
- # #Assumes standard POVM labels
828
- # povm = _objs.UnconstrainedPOVM( [('0_cm', target_model.povms['Mdefault']['0']),
829
- # ('1_cm', target_model.povms['Mdefault']['1'])] )
830
- # ave_error_gsl = _cnst.to_circuits([('rho0','Gavg'),('rho0','GR'),('rho0','Gavg','GQ')])
831
- # data = _cnst.simulate_data(error_gs, ave_error_gsl, num_samples=1, sample_error="none")#
832
-
833
- # pr_L_p = data[('rho0','Gavg')][success_outcomelabel]
834
- # pr_L_I = data[('rho0','Gavg')][success_outcomelabel_cm]
835
- # pr_R_p = data[('rho0','GR')][success_outcomelabel]
836
- # pr_R_I = data[('rho0','GR')][success_outcomelabel_cm]
837
- # pr_Q_p = data[('rho0','Gavg','GQ')][success_outcomelabel]
838
- # p = MTPs['p']
839
- # B_1 = pr_R_I
840
- # A_1 = (pr_Q_p/p) - pr_L_p + ((p -1)*pr_L_I/p) + ((pr_R_p - pr_R_I)/p)
841
- # C_1 = pr_L_p - pr_L_I
842
- # q = _tls.average_gate_infidelity(error_gs.operations['GQ2'],_np.identity(d**2,float))
843
- # q = _analysis.r_to_p(q,d,rtype='AGI')
844
- #
845
- # if order == 'zeroth':
846
- # MTPs['A'] = pr_L_I
847
- # MTPs['B'] = pr_L_p - pr_L_I
848
- # if order == 'first':
849
- # MTPs['A'] = B_1
850
- # MTPs['B'] = A_1 - C_1*(q - 1)/p**2
851
- # MTPs['C'] = C_1*(q- p**2)/p**2
852
- #
853
- # if order == 'zeroth':
854
- # Pm = MTPs['A'] + MTPs['B']*MTPs['p']**_np.array(mlist)
855
- # if order == 'first':
856
- # Pm = MTPs['A'] + (MTPs['B'] + _np.array(mlist)*MTPs['C'])*MTPs['p']**_np.array(mlist)
857
- #
858
- # sys_eb = (MTPs['delta'] + 1)**(_np.array(mlist)+1) - 1
859
- # if order == 'first':
860
- # sys_eb = sys_eb - (_np.array(mlist)+1)*MTPs['delta']
861
- #
862
- # upper = Pm + sys_eb
863
- # upper[upper > 1]=1.
864
- #
865
- # lower = Pm - sys_eb
866
- # lower[lower < 0]=0.
867
- #
868
- # return mlist, Pm, upper, lower, MTPs
@@ -26,7 +26,8 @@ def length(s):
26
26
  -------
27
27
  int
28
28
  """
29
- if not isinstance(s, slice): return len(s)
29
+ if not isinstance(s, slice):
30
+ return len(s)
30
31
  if s.start is None or s.stop is None:
31
32
  return 0
32
33
  if s.step is None:
@@ -191,7 +192,8 @@ def indices(s, n=None):
191
192
  elif s.start < 0:
192
193
  assert(n is not None), "Must supply `n` to obtain indices of a slice with negative start point!"
193
194
  start = n + s.start
194
- else: start = s.start
195
+ else:
196
+ start = s.start
195
197
 
196
198
  if s.stop is None:
197
199
  assert(n is not None), "Must supply `n` to obtain indices of a slice with unspecified stop point!"
@@ -199,12 +201,56 @@ def indices(s, n=None):
199
201
  elif s.stop < 0:
200
202
  assert(n is not None), "Must supply `n` to obtain indices of a slice with negative stop point!"
201
203
  stop = n + s.stop
202
- else: stop = s.stop
204
+ else:
205
+ stop = s.stop
203
206
 
204
207
  if s.step is None:
205
208
  return list(range(start, stop))
206
- return list(range(start, stop, s.step))
209
+ else:
210
+ return list(range(start, stop, s.step))
211
+
212
+ def indices_as_array(s, n=None):
213
+ """
214
+ Returns a numpy array of the indices specified by slice `s`.
215
+
216
+ Parameters
217
+ ----------
218
+ s : slice
219
+ The slice to operate upon.
220
+
221
+ n : int, optional
222
+ The number of elements in the array being indexed,
223
+ used for computing *negative* start/stop points.
224
+
225
+ Returns
226
+ -------
227
+ numpy ndarray array of integers
228
+ """
229
+ if s.start is None and s.stop is None:
230
+ return []
231
+
232
+ if s.start is None:
233
+ start = 0
234
+ elif s.start < 0:
235
+ assert(n is not None), "Must supply `n` to obtain indices of a slice with negative start point!"
236
+ start = n + s.start
237
+ else:
238
+ start = s.start
239
+
240
+ if s.stop is None:
241
+ assert(n is not None), "Must supply `n` to obtain indices of a slice with unspecified stop point!"
242
+ stop = n
243
+ elif s.stop < 0:
244
+ assert(n is not None), "Must supply `n` to obtain indices of a slice with negative stop point!"
245
+ stop = n + s.stop
246
+ else:
247
+ stop = s.stop
207
248
 
249
+ if s.step is None:
250
+ return _np.arange(start, stop, dtype=_np.int64)
251
+ else:
252
+ return _np.arange(start, stop, s.step, dtype=_np.int64)
253
+
208
254
 
209
255
  def list_to_slice(lst, array_ok=False, require_contiguous=True):
210
256
  """
@@ -240,17 +286,23 @@ def list_to_slice(lst, array_ok=False, require_contiguous=True):
240
286
  else:
241
287
  raise ValueError("Slice must be contiguous!")
242
288
  return lst
243
- if lst is None or len(lst) == 0: return slice(0, 0)
289
+ if lst is None or len(lst) == 0:
290
+ return slice(0, 0)
244
291
  start = lst[0]
245
292
 
246
- if len(lst) == 1: return slice(start, start + 1)
247
- step = lst[1] - lst[0]; stop = start + step * len(lst)
293
+ if len(lst) == 1:
294
+ return slice(start, start + 1)
295
+ step = lst[1] - lst[0]
296
+ stop = start + step * len(lst)
248
297
 
249
- if list(lst) == list(range(start, stop, step)):
298
+ if step != 0 and list(lst) == list(range(start, stop, step)):
250
299
  if require_contiguous and step != 1:
251
- if array_ok: return _np.array(lst, _np.int64)
252
- else: raise ValueError("Slice must be contiguous (or array_ok must be True)!")
253
- if step == 1: step = None
300
+ if array_ok:
301
+ return _np.array(lst, _np.int64)
302
+ else:
303
+ raise ValueError("Slice must be contiguous (or array_ok must be True)!")
304
+ if step == 1:
305
+ step = None
254
306
  return slice(start, stop, step)
255
307
  elif array_ok:
256
308
  return _np.array(lst, _np.int64)
@@ -272,7 +324,7 @@ def to_array(slc_or_list_like):
272
324
  numpy.ndarray
273
325
  """
274
326
  if isinstance(slc_or_list_like, slice):
275
- return _np.array(indices(slc_or_list_like), _np.int64)
327
+ return indices_as_array(slc_or_list_like)
276
328
  else:
277
329
  return _np.array(slc_or_list_like, _np.int64)
278
330
 
@@ -1,155 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: pyGSTi
3
- Version: 0.9.12.1
4
- Summary: A python implementation of Gate Set Tomography
5
- Home-page: http://www.pygsti.info
6
- Download-URL: https://github.com/pyGSTio/pyGSTi/tarball/master
7
- Author: Erik Nielsen, Kenneth Rudinger, Timothy Proctor, John Gamble, Robin Blume-Kohout
8
- Author-email: pygsti@sandia.gov
9
- Keywords: pygsti,tomography,gate set,pigsty,pig,quantum,qubit
10
- Platform: any
11
- Classifier: Development Status :: 4 - Beta
12
- Classifier: Intended Audience :: Science/Research
13
- Classifier: License :: OSI Approved :: Apache Software License
14
- Classifier: Programming Language :: Python
15
- Classifier: Topic :: Scientific/Engineering :: Physics
16
- Classifier: Operating System :: Microsoft :: Windows
17
- Classifier: Operating System :: MacOS :: MacOS X
18
- Classifier: Operating System :: Unix
19
- Requires-Python: >=3.5
20
- License-File: LICENSE
21
- Requires-Dist: numpy >=1.15.0
22
- Requires-Dist: scipy
23
- Requires-Dist: plotly
24
- Requires-Dist: pandas
25
- Provides-Extra: complete
26
- Requires-Dist: psutil ; extra == 'complete'
27
- Requires-Dist: csaps ; extra == 'complete'
28
- Requires-Dist: pymongo ; extra == 'complete'
29
- Requires-Dist: cvxpy ; extra == 'complete'
30
- Requires-Dist: ipython ; extra == 'complete'
31
- Requires-Dist: mpi4py ; extra == 'complete'
32
- Requires-Dist: zmq ; extra == 'complete'
33
- Requires-Dist: seaborn ; extra == 'complete'
34
- Requires-Dist: deap ; extra == 'complete'
35
- Requires-Dist: ply ; extra == 'complete'
36
- Requires-Dist: pytest ; extra == 'complete'
37
- Requires-Dist: nbval ; extra == 'complete'
38
- Requires-Dist: MarkupSafe ; extra == 'complete'
39
- Requires-Dist: pytest-xdist ; extra == 'complete'
40
- Requires-Dist: matplotlib ; extra == 'complete'
41
- Requires-Dist: autopep8 ; extra == 'complete'
42
- Requires-Dist: jupyter-server ; extra == 'complete'
43
- Requires-Dist: jinja2 ; extra == 'complete'
44
- Requires-Dist: pytest-cov ; extra == 'complete'
45
- Requires-Dist: msgpack ; extra == 'complete'
46
- Requires-Dist: flake8 ; extra == 'complete'
47
- Requires-Dist: cython ; extra == 'complete'
48
- Requires-Dist: pandas ; extra == 'complete'
49
- Requires-Dist: packaging ; extra == 'complete'
50
- Requires-Dist: cirq-core ; extra == 'complete'
51
- Requires-Dist: qibo <=0.1.7 ; extra == 'complete'
52
- Requires-Dist: notebook ; extra == 'complete'
53
- Requires-Dist: cvxopt ; extra == 'complete'
54
- Provides-Extra: diamond_norm
55
- Requires-Dist: cvxopt ; extra == 'diamond_norm'
56
- Requires-Dist: cvxpy ; extra == 'diamond_norm'
57
- Provides-Extra: evolutionary_optimization
58
- Requires-Dist: deap ; extra == 'evolutionary_optimization'
59
- Provides-Extra: extensions
60
- Requires-Dist: cython ; extra == 'extensions'
61
- Provides-Extra: html_reports
62
- Requires-Dist: jinja2 ; extra == 'html_reports'
63
- Requires-Dist: MarkupSafe ; extra == 'html_reports'
64
- Provides-Extra: interpygate
65
- Requires-Dist: csaps ; extra == 'interpygate'
66
- Provides-Extra: linting
67
- Requires-Dist: autopep8 ; extra == 'linting'
68
- Requires-Dist: flake8 ; extra == 'linting'
69
- Provides-Extra: memory_profiling
70
- Requires-Dist: psutil ; extra == 'memory_profiling'
71
- Provides-Extra: mongodb
72
- Requires-Dist: pymongo ; extra == 'mongodb'
73
- Provides-Extra: msgpack
74
- Requires-Dist: msgpack ; extra == 'msgpack'
75
- Provides-Extra: multiprocessor
76
- Requires-Dist: mpi4py ; extra == 'multiprocessor'
77
- Provides-Extra: no_mpi
78
- Requires-Dist: psutil ; extra == 'no_mpi'
79
- Requires-Dist: csaps ; extra == 'no_mpi'
80
- Requires-Dist: pymongo ; extra == 'no_mpi'
81
- Requires-Dist: cvxpy ; extra == 'no_mpi'
82
- Requires-Dist: ipython ; extra == 'no_mpi'
83
- Requires-Dist: zmq ; extra == 'no_mpi'
84
- Requires-Dist: seaborn ; extra == 'no_mpi'
85
- Requires-Dist: deap ; extra == 'no_mpi'
86
- Requires-Dist: ply ; extra == 'no_mpi'
87
- Requires-Dist: pytest ; extra == 'no_mpi'
88
- Requires-Dist: nbval ; extra == 'no_mpi'
89
- Requires-Dist: MarkupSafe ; extra == 'no_mpi'
90
- Requires-Dist: pytest-xdist ; extra == 'no_mpi'
91
- Requires-Dist: matplotlib ; extra == 'no_mpi'
92
- Requires-Dist: autopep8 ; extra == 'no_mpi'
93
- Requires-Dist: jupyter-server ; extra == 'no_mpi'
94
- Requires-Dist: jinja2 ; extra == 'no_mpi'
95
- Requires-Dist: pytest-cov ; extra == 'no_mpi'
96
- Requires-Dist: msgpack ; extra == 'no_mpi'
97
- Requires-Dist: flake8 ; extra == 'no_mpi'
98
- Requires-Dist: cython ; extra == 'no_mpi'
99
- Requires-Dist: pandas ; extra == 'no_mpi'
100
- Requires-Dist: packaging ; extra == 'no_mpi'
101
- Requires-Dist: cirq-core ; extra == 'no_mpi'
102
- Requires-Dist: qibo <=0.1.7 ; extra == 'no_mpi'
103
- Requires-Dist: notebook ; extra == 'no_mpi'
104
- Requires-Dist: cvxopt ; extra == 'no_mpi'
105
- Provides-Extra: notebooks
106
- Requires-Dist: ipython ; extra == 'notebooks'
107
- Requires-Dist: notebook ; extra == 'notebooks'
108
- Requires-Dist: jupyter-server ; extra == 'notebooks'
109
- Provides-Extra: report_pdf_figures
110
- Requires-Dist: matplotlib ; extra == 'report_pdf_figures'
111
- Provides-Extra: report_pickling
112
- Requires-Dist: pandas ; extra == 'report_pickling'
113
- Provides-Extra: testing
114
- Requires-Dist: pytest ; extra == 'testing'
115
- Requires-Dist: pytest-xdist ; extra == 'testing'
116
- Requires-Dist: pytest-cov ; extra == 'testing'
117
- Requires-Dist: nbval ; extra == 'testing'
118
- Requires-Dist: csaps ; extra == 'testing'
119
- Requires-Dist: cvxopt ; extra == 'testing'
120
- Requires-Dist: cvxpy ; extra == 'testing'
121
- Requires-Dist: cython ; extra == 'testing'
122
- Requires-Dist: matplotlib ; extra == 'testing'
123
- Requires-Dist: mpi4py ; extra == 'testing'
124
- Requires-Dist: msgpack ; extra == 'testing'
125
- Requires-Dist: packaging ; extra == 'testing'
126
- Requires-Dist: pandas ; extra == 'testing'
127
- Requires-Dist: psutil ; extra == 'testing'
128
- Requires-Dist: zmq ; extra == 'testing'
129
- Requires-Dist: jinja2 ; extra == 'testing'
130
- Requires-Dist: seaborn ; extra == 'testing'
131
- Requires-Dist: ply ; extra == 'testing'
132
- Requires-Dist: qibo <=0.1.7 ; extra == 'testing'
133
- Requires-Dist: cirq-core ; extra == 'testing'
134
- Requires-Dist: notebook ; extra == 'testing'
135
- Requires-Dist: ipython ; extra == 'testing'
136
- Requires-Dist: jupyter-server ; extra == 'testing'
137
-
138
- Gate set tomography (GST) is a quantum tomography protocol that provides full characterization of a quantum logic device
139
- (e.g. a qubit). GST estimates a set of quantum logic gates and (simultaneously) the associated state preparation and
140
- measurement (SPAM) operations. GST is self-calibrating. This eliminates a key limitation of traditional quantum state
141
- and process tomography, which characterize either states (assuming perfect processes) or processes (assuming perfect
142
- state preparation and measurement), but not both together. Compared with benchmarking protocols such as randomized
143
- benchmarking, GST provides much more detailed and accurate information about the gates, but demands more data. The
144
- primary downside of GST has been its complexity. Whereas benchmarking and state/process tomography data can be analyzed
145
- with relatively simple algorithms, GST requires more complex algorithms and more fine-tuning (linear GST is an exception
146
- that can be implemented easily). pyGSTi addresses and eliminates this obstacle by providing a fully-featured, publicly
147
- available implementation of GST in the Python programming language.
148
-
149
- The primary goals of the pyGSTi project are to:
150
-
151
- - provide efficient and robust implementations of Gate Set Tomography algorithms;
152
- - allow straightforward interoperability with other software;
153
- - provide a powerful high-level interface suited to inexperienced programmers, so that
154
- common GST tasks can be performed using just one or two lines of code;
155
- - use modular design to make it easy for users to modify, customize, and extend GST functionality.