pyGSTi 0.9.12__cp38-cp38-win32.whl → 0.9.13__cp38-cp38-win32.whl
Sign up to get free protection for your applications and to get access to all the features.
- pyGSTi-0.9.13.dist-info/METADATA +185 -0
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/RECORD +211 -220
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/WHEEL +1 -1
- pygsti/_version.py +2 -2
- pygsti/algorithms/contract.py +1 -1
- pygsti/algorithms/core.py +62 -35
- pygsti/algorithms/fiducialpairreduction.py +95 -110
- pygsti/algorithms/fiducialselection.py +17 -8
- pygsti/algorithms/gaugeopt.py +2 -2
- pygsti/algorithms/germselection.py +87 -77
- pygsti/algorithms/mirroring.py +0 -388
- pygsti/algorithms/randomcircuit.py +165 -1333
- pygsti/algorithms/rbfit.py +0 -234
- pygsti/baseobjs/basis.py +94 -396
- pygsti/baseobjs/errorgenbasis.py +0 -132
- pygsti/baseobjs/errorgenspace.py +0 -10
- pygsti/baseobjs/label.py +52 -168
- pygsti/baseobjs/opcalc/fastopcalc.cp38-win32.pyd +0 -0
- pygsti/baseobjs/opcalc/fastopcalc.pyx +2 -2
- pygsti/baseobjs/polynomial.py +13 -595
- pygsti/baseobjs/protectedarray.py +72 -132
- pygsti/baseobjs/statespace.py +1 -0
- pygsti/circuits/__init__.py +1 -1
- pygsti/circuits/circuit.py +753 -504
- pygsti/circuits/circuitconstruction.py +0 -4
- pygsti/circuits/circuitlist.py +47 -5
- pygsti/circuits/circuitparser/__init__.py +8 -8
- pygsti/circuits/circuitparser/fastcircuitparser.cp38-win32.pyd +0 -0
- pygsti/circuits/circuitstructure.py +3 -3
- pygsti/circuits/cloudcircuitconstruction.py +27 -14
- pygsti/data/datacomparator.py +4 -9
- pygsti/data/dataset.py +51 -46
- pygsti/data/hypothesistest.py +0 -7
- pygsti/drivers/bootstrap.py +0 -49
- pygsti/drivers/longsequence.py +46 -10
- pygsti/evotypes/basereps_cython.cp38-win32.pyd +0 -0
- pygsti/evotypes/chp/opreps.py +0 -61
- pygsti/evotypes/chp/statereps.py +0 -32
- pygsti/evotypes/densitymx/effectcreps.cpp +9 -10
- pygsti/evotypes/densitymx/effectreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/densitymx/effectreps.pyx +1 -1
- pygsti/evotypes/densitymx/opreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/densitymx/opreps.pyx +2 -2
- pygsti/evotypes/densitymx/statereps.cp38-win32.pyd +0 -0
- pygsti/evotypes/densitymx/statereps.pyx +1 -1
- pygsti/evotypes/densitymx_slow/effectreps.py +7 -23
- pygsti/evotypes/densitymx_slow/opreps.py +16 -23
- pygsti/evotypes/densitymx_slow/statereps.py +10 -3
- pygsti/evotypes/evotype.py +39 -2
- pygsti/evotypes/stabilizer/effectreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/stabilizer/effectreps.pyx +0 -4
- pygsti/evotypes/stabilizer/opreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/stabilizer/opreps.pyx +0 -4
- pygsti/evotypes/stabilizer/statereps.cp38-win32.pyd +0 -0
- pygsti/evotypes/stabilizer/statereps.pyx +1 -5
- pygsti/evotypes/stabilizer/termreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/stabilizer/termreps.pyx +0 -7
- pygsti/evotypes/stabilizer_slow/effectreps.py +0 -22
- pygsti/evotypes/stabilizer_slow/opreps.py +0 -4
- pygsti/evotypes/stabilizer_slow/statereps.py +0 -4
- pygsti/evotypes/statevec/effectreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/statevec/effectreps.pyx +1 -1
- pygsti/evotypes/statevec/opreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/statevec/opreps.pyx +2 -2
- pygsti/evotypes/statevec/statereps.cp38-win32.pyd +0 -0
- pygsti/evotypes/statevec/statereps.pyx +1 -1
- pygsti/evotypes/statevec/termreps.cp38-win32.pyd +0 -0
- pygsti/evotypes/statevec/termreps.pyx +0 -7
- pygsti/evotypes/statevec_slow/effectreps.py +0 -3
- pygsti/evotypes/statevec_slow/opreps.py +0 -5
- pygsti/extras/__init__.py +0 -1
- pygsti/extras/drift/signal.py +1 -1
- pygsti/extras/drift/stabilityanalyzer.py +3 -1
- pygsti/extras/interpygate/__init__.py +12 -0
- pygsti/extras/interpygate/core.py +0 -36
- pygsti/extras/interpygate/process_tomography.py +44 -10
- pygsti/extras/rpe/rpeconstruction.py +0 -2
- pygsti/forwardsims/__init__.py +1 -0
- pygsti/forwardsims/forwardsim.py +50 -93
- pygsti/forwardsims/mapforwardsim.py +78 -20
- pygsti/forwardsims/mapforwardsim_calc_densitymx.cp38-win32.pyd +0 -0
- pygsti/forwardsims/mapforwardsim_calc_densitymx.pyx +65 -66
- pygsti/forwardsims/mapforwardsim_calc_generic.py +91 -13
- pygsti/forwardsims/matrixforwardsim.py +72 -17
- pygsti/forwardsims/termforwardsim.py +9 -111
- pygsti/forwardsims/termforwardsim_calc_stabilizer.cp38-win32.pyd +0 -0
- pygsti/forwardsims/termforwardsim_calc_statevec.cp38-win32.pyd +0 -0
- pygsti/forwardsims/termforwardsim_calc_statevec.pyx +0 -651
- pygsti/forwardsims/torchfwdsim.py +265 -0
- pygsti/forwardsims/weakforwardsim.py +2 -2
- pygsti/io/__init__.py +1 -2
- pygsti/io/mongodb.py +0 -2
- pygsti/io/stdinput.py +6 -22
- pygsti/layouts/copalayout.py +10 -12
- pygsti/layouts/distlayout.py +0 -40
- pygsti/layouts/maplayout.py +103 -25
- pygsti/layouts/matrixlayout.py +99 -60
- pygsti/layouts/prefixtable.py +1534 -52
- pygsti/layouts/termlayout.py +1 -1
- pygsti/modelmembers/instruments/instrument.py +3 -3
- pygsti/modelmembers/instruments/tpinstrument.py +2 -2
- pygsti/modelmembers/modelmember.py +0 -17
- pygsti/modelmembers/operations/__init__.py +3 -4
- pygsti/modelmembers/operations/affineshiftop.py +206 -0
- pygsti/modelmembers/operations/composederrorgen.py +1 -1
- pygsti/modelmembers/operations/composedop.py +1 -24
- pygsti/modelmembers/operations/denseop.py +5 -5
- pygsti/modelmembers/operations/eigpdenseop.py +2 -2
- pygsti/modelmembers/operations/embeddederrorgen.py +1 -1
- pygsti/modelmembers/operations/embeddedop.py +0 -1
- pygsti/modelmembers/operations/experrorgenop.py +5 -2
- pygsti/modelmembers/operations/fullarbitraryop.py +1 -0
- pygsti/modelmembers/operations/fullcptpop.py +2 -2
- pygsti/modelmembers/operations/fulltpop.py +28 -6
- pygsti/modelmembers/operations/fullunitaryop.py +5 -4
- pygsti/modelmembers/operations/lindbladcoefficients.py +93 -78
- pygsti/modelmembers/operations/lindbladerrorgen.py +268 -441
- pygsti/modelmembers/operations/linearop.py +7 -27
- pygsti/modelmembers/operations/opfactory.py +1 -1
- pygsti/modelmembers/operations/repeatedop.py +1 -24
- pygsti/modelmembers/operations/staticstdop.py +1 -1
- pygsti/modelmembers/povms/__init__.py +3 -3
- pygsti/modelmembers/povms/basepovm.py +7 -36
- pygsti/modelmembers/povms/complementeffect.py +4 -9
- pygsti/modelmembers/povms/composedeffect.py +0 -320
- pygsti/modelmembers/povms/computationaleffect.py +1 -1
- pygsti/modelmembers/povms/computationalpovm.py +3 -1
- pygsti/modelmembers/povms/effect.py +3 -5
- pygsti/modelmembers/povms/marginalizedpovm.py +3 -81
- pygsti/modelmembers/povms/tppovm.py +74 -2
- pygsti/modelmembers/states/__init__.py +2 -5
- pygsti/modelmembers/states/composedstate.py +0 -317
- pygsti/modelmembers/states/computationalstate.py +3 -3
- pygsti/modelmembers/states/cptpstate.py +4 -4
- pygsti/modelmembers/states/densestate.py +10 -8
- pygsti/modelmembers/states/fullpurestate.py +0 -24
- pygsti/modelmembers/states/purestate.py +1 -1
- pygsti/modelmembers/states/state.py +5 -6
- pygsti/modelmembers/states/tpstate.py +28 -10
- pygsti/modelmembers/term.py +3 -6
- pygsti/modelmembers/torchable.py +50 -0
- pygsti/modelpacks/_modelpack.py +1 -1
- pygsti/modelpacks/smq1Q_ZN.py +3 -1
- pygsti/modelpacks/smq2Q_XXYYII.py +2 -1
- pygsti/modelpacks/smq2Q_XY.py +3 -3
- pygsti/modelpacks/smq2Q_XYI.py +2 -2
- pygsti/modelpacks/smq2Q_XYICNOT.py +3 -3
- pygsti/modelpacks/smq2Q_XYICPHASE.py +3 -3
- pygsti/modelpacks/smq2Q_XYXX.py +1 -1
- pygsti/modelpacks/smq2Q_XYZICNOT.py +3 -3
- pygsti/modelpacks/smq2Q_XYZZ.py +1 -1
- pygsti/modelpacks/stdtarget.py +0 -121
- pygsti/models/cloudnoisemodel.py +1 -2
- pygsti/models/explicitcalc.py +3 -3
- pygsti/models/explicitmodel.py +3 -13
- pygsti/models/fogistore.py +5 -3
- pygsti/models/localnoisemodel.py +1 -2
- pygsti/models/memberdict.py +0 -12
- pygsti/models/model.py +801 -68
- pygsti/models/modelconstruction.py +4 -4
- pygsti/models/modelnoise.py +2 -2
- pygsti/models/modelparaminterposer.py +1 -1
- pygsti/models/oplessmodel.py +1 -1
- pygsti/models/qutrit.py +15 -14
- pygsti/objectivefns/objectivefns.py +75 -140
- pygsti/objectivefns/wildcardbudget.py +2 -7
- pygsti/optimize/__init__.py +1 -0
- pygsti/optimize/arraysinterface.py +28 -0
- pygsti/optimize/customcg.py +0 -12
- pygsti/optimize/customlm.py +129 -323
- pygsti/optimize/customsolve.py +2 -2
- pygsti/optimize/optimize.py +0 -84
- pygsti/optimize/simplerlm.py +841 -0
- pygsti/optimize/wildcardopt.py +19 -598
- pygsti/protocols/confidenceregionfactory.py +28 -14
- pygsti/protocols/estimate.py +31 -14
- pygsti/protocols/gst.py +238 -142
- pygsti/protocols/modeltest.py +19 -12
- pygsti/protocols/protocol.py +9 -37
- pygsti/protocols/rb.py +450 -79
- pygsti/protocols/treenode.py +8 -2
- pygsti/protocols/vb.py +108 -206
- pygsti/protocols/vbdataframe.py +1 -1
- pygsti/report/factory.py +0 -15
- pygsti/report/fogidiagram.py +1 -17
- pygsti/report/modelfunction.py +12 -3
- pygsti/report/mpl_colormaps.py +1 -1
- pygsti/report/plothelpers.py +11 -3
- pygsti/report/report.py +16 -0
- pygsti/report/reportables.py +41 -37
- pygsti/report/templates/offline/pygsti_dashboard.css +6 -0
- pygsti/report/templates/offline/pygsti_dashboard.js +12 -0
- pygsti/report/workspace.py +2 -14
- pygsti/report/workspaceplots.py +328 -505
- pygsti/tools/basistools.py +9 -36
- pygsti/tools/edesigntools.py +124 -96
- pygsti/tools/fastcalc.cp38-win32.pyd +0 -0
- pygsti/tools/fastcalc.pyx +35 -81
- pygsti/tools/internalgates.py +151 -15
- pygsti/tools/jamiolkowski.py +5 -5
- pygsti/tools/lindbladtools.py +19 -11
- pygsti/tools/listtools.py +0 -114
- pygsti/tools/matrixmod2.py +1 -1
- pygsti/tools/matrixtools.py +173 -339
- pygsti/tools/nameddict.py +1 -1
- pygsti/tools/optools.py +154 -88
- pygsti/tools/pdftools.py +0 -25
- pygsti/tools/rbtheory.py +3 -320
- pygsti/tools/slicetools.py +64 -12
- pyGSTi-0.9.12.dist-info/METADATA +0 -157
- pygsti/algorithms/directx.py +0 -711
- pygsti/evotypes/qibo/__init__.py +0 -33
- pygsti/evotypes/qibo/effectreps.py +0 -78
- pygsti/evotypes/qibo/opreps.py +0 -376
- pygsti/evotypes/qibo/povmreps.py +0 -98
- pygsti/evotypes/qibo/statereps.py +0 -174
- pygsti/extras/rb/__init__.py +0 -13
- pygsti/extras/rb/benchmarker.py +0 -957
- pygsti/extras/rb/dataset.py +0 -378
- pygsti/extras/rb/io.py +0 -814
- pygsti/extras/rb/simulate.py +0 -1020
- pygsti/io/legacyio.py +0 -385
- pygsti/modelmembers/povms/denseeffect.py +0 -142
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/LICENSE +0 -0
- {pyGSTi-0.9.12.dist-info → pyGSTi-0.9.13.dist-info}/top_level.txt +0 -0
pygsti/io/legacyio.py
DELETED
@@ -1,385 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Functions for allowing old-vesion objects to unpickle load.
|
3
|
-
"""
|
4
|
-
#***************************************************************************************************
|
5
|
-
# Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
|
6
|
-
# Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights
|
7
|
-
# in this software.
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
9
|
-
# in compliance with the License. You may obtain a copy of the License at
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0 or in the LICENSE file in the root pyGSTi directory.
|
11
|
-
#***************************************************************************************************
|
12
|
-
|
13
|
-
|
14
|
-
#These functions no longer work, and the changes have become too great to retain
|
15
|
-
# backward compatibility with old versions. Keep this commented code around
|
16
|
-
# for potentially adding similar functionality in future versions.
|
17
|
-
#
|
18
|
-
#import numbers as _numbers
|
19
|
-
#import sys as _sys
|
20
|
-
#from contextlib import contextmanager as _contextmanager
|
21
|
-
#from types import ModuleType as _ModuleType
|
22
|
-
#
|
23
|
-
#from .. import objects as _objs
|
24
|
-
#from .. import circuits as _circuits
|
25
|
-
#from ..circuits import circuit as _circuit
|
26
|
-
#from ..objects.replib import slowreplib as _slow
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#@_contextmanager
|
30
|
-
#def enable_no_cython_unpickling():
|
31
|
-
# """
|
32
|
-
# Context manager for unpickling objects constructed *with* Cython extensions.
|
33
|
-
#
|
34
|
-
# A context manager enabling the un-pickling of pyGSTi objects that
|
35
|
-
# were constructed on a system *with* pyGSTi's C-extensions, when the
|
36
|
-
# current system's pyGSTi does not have these extensions.
|
37
|
-
# """
|
38
|
-
#
|
39
|
-
# class dummy_DMStateRep(object):
|
40
|
-
# def __new__(cls, data, reducefix):
|
41
|
-
# #replacement_obj = _slow.DMStateRep.__new__(_slow.DMStateRep)
|
42
|
-
# replacement_obj = _slow.DMStateRep(data, reducefix)
|
43
|
-
# return replacement_obj
|
44
|
-
#
|
45
|
-
# class dummy_DMEffectRepDense(object):
|
46
|
-
# def __new__(cls, data, reducefix):
|
47
|
-
# #replacement_obj = _slow.DMEffectRepDense.__new__(_slow.DMEffectRepDense)
|
48
|
-
# replacement_obj = _slow.DMEffectRepDense(data, reducefix)
|
49
|
-
# return replacement_obj
|
50
|
-
#
|
51
|
-
# class dummy_DMOpRepDense(object):
|
52
|
-
# def __new__(cls, data, reducefix):
|
53
|
-
# #replacement_obj = _slow.DMOpRepDense.__new__(_slow.DMEffectRepDense)
|
54
|
-
# replacement_obj = _slow.DMOpRepDense(data, reducefix)
|
55
|
-
# return replacement_obj
|
56
|
-
#
|
57
|
-
# assert(_sys.modules.get('pygsti.objects.replib.fastreplib', None) is None), \
|
58
|
-
# "You should only use this function when they Cython extensions are *not* built!"
|
59
|
-
# fastreplib = _ModuleType("fastreplib")
|
60
|
-
# fastreplib.DMStateRep = dummy_DMStateRep
|
61
|
-
# fastreplib.DMEffectRepDense = dummy_DMEffectRepDense
|
62
|
-
# fastreplib.DMOpRepDense = dummy_DMOpRepDense
|
63
|
-
# _sys.modules['pygsti.objects.replib.fastreplib'] = fastreplib
|
64
|
-
#
|
65
|
-
# yield
|
66
|
-
#
|
67
|
-
# del _sys.modules['pygsti.objects.replib.fastreplib']
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#@_contextmanager
|
71
|
-
#def enable_old_object_unpickling(old_version="0.9.6"):
|
72
|
-
# """
|
73
|
-
# Context manager enabling unpickling of old-verion objects.
|
74
|
-
#
|
75
|
-
# Returns a context manager which enables the unpickling of old-version (
|
76
|
-
# back to 0.9.6 and sometimes prior) objects.
|
77
|
-
#
|
78
|
-
# Parameters
|
79
|
-
# ----------
|
80
|
-
# old_version : str, optional
|
81
|
-
# The string representation of the old version whose pickle files you'd
|
82
|
-
# like to unpickle. E.g., `"0.9.7"`
|
83
|
-
# """
|
84
|
-
# def totup(v): return tuple(map(int, v.split('.')))
|
85
|
-
# old_version = totup(old_version)
|
86
|
-
#
|
87
|
-
# if old_version < totup("0.9.6"):
|
88
|
-
# raise ValueError(("Cannot unpickle files from version < 0.9.6 with this version."
|
89
|
-
# " Revert back to 0.9.6 and update to 0.9.6 first."))
|
90
|
-
#
|
91
|
-
# if old_version == totup("0.9.6"):
|
92
|
-
# class dummy_GateString(object):
|
93
|
-
# def __new__(cls):
|
94
|
-
# replacement_obj = _circuit.Circuit.__new__(_circuit.Circuit)
|
95
|
-
# return replacement_obj
|
96
|
-
#
|
97
|
-
# def GateString_setstate(self, state):
|
98
|
-
# s = state['_str'] if '_str' in state else state['str']
|
99
|
-
# c = _objs.Circuit(state['_tup'], stringrep=s)
|
100
|
-
# #OLD: self.__dict__.update(c.__dict__)
|
101
|
-
# return c.__dict__ # now just return updated Circuit state
|
102
|
-
#
|
103
|
-
# class dummy_CompressedGateString(object):
|
104
|
-
# def __new__(cls):
|
105
|
-
# replacement_obj = _circuit.CompressedCircuit.__new__(_circuit.CompressedCircuit)
|
106
|
-
# return replacement_obj
|
107
|
-
#
|
108
|
-
# class dummy_GateSet(object):
|
109
|
-
# def __new__(cls):
|
110
|
-
# replacement_obj = _objs.ExplicitOpModel.__new__(_objs.ExplicitOpModel)
|
111
|
-
# return replacement_obj
|
112
|
-
#
|
113
|
-
# class dummy_GateMatrixCalc(object):
|
114
|
-
# def __new__(cls):
|
115
|
-
# replacement_obj = _objs.MatrixForwardSimulator.__new__(_objs.MatrixForwardSimulator)
|
116
|
-
# return replacement_obj
|
117
|
-
#
|
118
|
-
# class dummy_AutoGator(object): pass
|
119
|
-
# class dummy_SimpleCompositionAutoGator(object): pass
|
120
|
-
#
|
121
|
-
# class dummy_LindbladParameterizedGate(object):
|
122
|
-
# def __new__(cls):
|
123
|
-
# replacement_obj = _objs.LindbladDenseOp.__new__(_objs.LindbladDenseOp)
|
124
|
-
# return replacement_obj
|
125
|
-
#
|
126
|
-
# def Lind_setstate(self, state):
|
127
|
-
# assert(not state['sparse']), "Can only unpickle old *dense* LindbladParameterizedGate objects"
|
128
|
-
# g = _objs.LindbladDenseOp.from_operation_matrix(state['base'], state['unitary_postfactor'],
|
129
|
-
# ham_basis=state['ham_basis'],
|
130
|
-
# nonham_basis=state['other_basis'],
|
131
|
-
# param_mode=state['param_mode'],
|
132
|
-
# nonham_mode=state['nonham_mode'], truncate=True,
|
133
|
-
# mx_basis=state['matrix_basis'], evotype=state['_evotype'])
|
134
|
-
# self.__dict__.update(g.__dict__)
|
135
|
-
#
|
136
|
-
# def ModelMember_setstate(self, state):
|
137
|
-
# if "dirty" in state: # .dirty was replaced with ._dirty
|
138
|
-
# state['_dirty'] = state['dirty']
|
139
|
-
# del state['dirty']
|
140
|
-
# self.__dict__.update(state)
|
141
|
-
#
|
142
|
-
# #Modules
|
143
|
-
# gatestring = _ModuleType("gatestring")
|
144
|
-
# gatestring.GateString = dummy_GateString
|
145
|
-
# gatestring.CompressedGateString = dummy_CompressedGateString
|
146
|
-
# _sys.modules['pygsti.objects.gatestring'] = gatestring
|
147
|
-
# #_objs.circuit.Circuit.__setstate__ = GateString_setstate Never needed now
|
148
|
-
#
|
149
|
-
# gateset = _ModuleType("gateset")
|
150
|
-
# gateset.GateSet = dummy_GateSet
|
151
|
-
# _sys.modules['pygsti.objects.gateset'] = gateset
|
152
|
-
#
|
153
|
-
# gate = _ModuleType("gate")
|
154
|
-
# gate.EigenvalueParameterizedGate = _objs.EigenvalueParamDenseOp
|
155
|
-
# gate.LinearlyParameterizedGate = _objs.LinearlyParamDenseOp
|
156
|
-
# #gate.LindbladParameterizedGateMap = _objs.LindbladOp # no upgrade code for this yet
|
157
|
-
# gate.LindbladParameterizedGate = dummy_LindbladParameterizedGate
|
158
|
-
# _objs.LindbladDenseOp.__setstate__ = Lind_setstate # dummy_LindbladParameterizedGate.__setstate__
|
159
|
-
# gate.FullyParameterizedGate = _objs.FullDenseOp
|
160
|
-
# gate.TPParameterizedGate = _objs.TPDenseOp
|
161
|
-
# gate.GateMatrix = _objs.DenseOperator
|
162
|
-
# gate.ComposedGateMap = _objs.ComposedOp
|
163
|
-
# gate.EmbeddedGateMap = _objs.EmbeddedOp
|
164
|
-
# gate.ComposedGate = _objs.ComposedDenseOp
|
165
|
-
# gate.EmbeddedGate = _objs.EmbeddedDenseOp
|
166
|
-
# gate.StaticGate = _objs.StaticDenseOp
|
167
|
-
# gate.LinearlyParameterizedElementTerm = _objs.operation.LinearlyParameterizedElementTerm
|
168
|
-
# #MapOp = _objs.MapOperator
|
169
|
-
# _sys.modules['pygsti.objects.gate'] = gate
|
170
|
-
#
|
171
|
-
# # spamvec = _ModuleType("spamvec") #already exists - just add to it
|
172
|
-
# spamvec = _sys.modules['pygsti.objects.spamvec']
|
173
|
-
# spamvec.LindbladParameterizedSPAMVec = _objs.LindbladSPAMVec
|
174
|
-
# spamvec.FullyParameterizedSPAMVec = _objs.FullSPAMVec
|
175
|
-
# spamvec.CPTPParameterizedSPAMVec = _objs.CPTPSPAMVec
|
176
|
-
# spamvec.TPParameterizedSPAMVec = _objs.TPSPAMVec
|
177
|
-
#
|
178
|
-
# povm = _sys.modules['pygsti.objects.povm']
|
179
|
-
# povm.LindbladParameterizedPOVM = _objs.LindbladPOVM
|
180
|
-
#
|
181
|
-
# #Don't need class logic here b/c we just store the class itself in a model object:
|
182
|
-
# gatematrixcalc = _ModuleType("gatematrixcalc")
|
183
|
-
# gatematrixcalc.GateMatrixCalc = _objs.matrixforwardsim.MatrixForwardSimulator # dummy_GateMatrixCalc
|
184
|
-
# _sys.modules['pygsti.objects.gatematrixcalc'] = gatematrixcalc
|
185
|
-
#
|
186
|
-
# autogator = _ModuleType("autogator")
|
187
|
-
# autogator.AutoGator = dummy_AutoGator
|
188
|
-
# autogator.SimpleCompositionAutoGator = dummy_SimpleCompositionAutoGator
|
189
|
-
# _sys.modules['pygsti.objects.autogator'] = autogator
|
190
|
-
#
|
191
|
-
# #These have been removed now!
|
192
|
-
# #gatestringstructure = _ModuleType("gatestringstructure")
|
193
|
-
# #gatestringstructure.GatestringPlaquette = _objs.circuitstructure.CircuitPlaquette
|
194
|
-
# #gatestringstructure.GateStringStructure = _objs.CircuitStructure
|
195
|
-
# #gatestringstructure.LsGermsStructure = _objs.LsGermsStructure
|
196
|
-
#
|
197
|
-
# #_sys.modules['pygsti.objects.gatestringstructure'] = gatestringstructure
|
198
|
-
#
|
199
|
-
# _objs.modelmember.ModelMember.__setstate__ = ModelMember_setstate
|
200
|
-
#
|
201
|
-
# if old_version <= totup("0.9.7.1"):
|
202
|
-
# class dummy_Basis(object):
|
203
|
-
# def __new__(cls):
|
204
|
-
# replacement_obj = _objs.basis.BuiltinBasis.__new__(_objs.basis.BuiltinBasis)
|
205
|
-
# return replacement_obj
|
206
|
-
#
|
207
|
-
# def __setstate__(self, state):
|
208
|
-
# return Basis_setstate(self, state)
|
209
|
-
#
|
210
|
-
# def Basis_setstate(self, state):
|
211
|
-
# if "labels" in state: # .label was replaced with ._label
|
212
|
-
# state['_labels'] = state['labels']
|
213
|
-
# del state['labels']
|
214
|
-
#
|
215
|
-
# if "name" in state and state['name'] in ('pp', 'std', 'gm', 'qt', 'unknown') and 'dim' in state:
|
216
|
-
# dim = state['dim'].opDim if hasattr(state['dim'], 'opDim') else state['dim']
|
217
|
-
# assert(isinstance(dim, _numbers.Integral))
|
218
|
-
# sparse = state['sparse'] if ('sparse' in state) else False
|
219
|
-
# newBasis = _objs.BuiltinBasis(state['name'], int(dim), sparse)
|
220
|
-
# self.__class__ = _objs.basis.BuiltinBasis
|
221
|
-
# self.__dict__.update(newBasis.__dict__)
|
222
|
-
# else:
|
223
|
-
# raise ValueError("Can only load old *builtin* basis objects!")
|
224
|
-
#
|
225
|
-
# class dummy_Dim(object):
|
226
|
-
# def __setstate__(self, state): # was Dim_setstate
|
227
|
-
# if "gateDim" in state: # .label was replaced with ._label
|
228
|
-
# state['opDim'] = state['gateDim']
|
229
|
-
# del state['gateDim']
|
230
|
-
# self.__dict__.update(state)
|
231
|
-
#
|
232
|
-
# def StateSpaceLabels_setstate(self, state):
|
233
|
-
# squared_labeldims = {k: int(d**2) for k, d in state['labeldims'].items()}
|
234
|
-
# squared_dims = [tuple((squared_labeldims[lbl] for lbl in tpbLbls))
|
235
|
-
# for tpbLbls in state['labels']]
|
236
|
-
# sslbls = _objs.StateSpaceLabels(state['labels'], squared_dims)
|
237
|
-
# self.__dict__.update(sslbls.__dict__)
|
238
|
-
#
|
239
|
-
# #DEBUG!!!
|
240
|
-
# #print("!!setstate:")
|
241
|
-
# #print(state)
|
242
|
-
# #assert(False),"STOP"
|
243
|
-
#
|
244
|
-
# def Circuit_setstate(self, state):
|
245
|
-
# if old_version == totup("0.9.6"): # b/c this clobbers older-version upgrade
|
246
|
-
# state = GateString_setstate(self, state)
|
247
|
-
#
|
248
|
-
# if 'line_labels' in state: line_labels = state['line_labels']
|
249
|
-
# elif '_line_labels' in state: line_labels = state['_line_labels']
|
250
|
-
# else: raise ValueError("Cannot determing line labels from old Circuit state: %s" % str(state.keys()))
|
251
|
-
#
|
252
|
-
# if state['_str']: # then rely on string rep to init new circuit
|
253
|
-
# c = _objs.Circuit(None, line_labels, editable=not state['_static'], stringrep=state['_str'])
|
254
|
-
# else:
|
255
|
-
#
|
256
|
-
# if 'labels' in state: labels = state['labels']
|
257
|
-
# elif '_labels' in state: labels = state['_labels']
|
258
|
-
# else: raise ValueError("Cannot determing labels from old Circuit state: %s" % str(state.keys()))
|
259
|
-
# c = _objs.Circuit(labels, line_labels, editable=not state['_static'])
|
260
|
-
#
|
261
|
-
# self.__dict__.update(c.__dict__)
|
262
|
-
#
|
263
|
-
# def Hack_CompressedCircuit_expand(self):
|
264
|
-
# """ Hacked version to rely on string rep & re-parse if it's there """
|
265
|
-
# return _objs.Circuit(None, self._line_labels, editable=False, stringrep=self._str)
|
266
|
-
#
|
267
|
-
# def SPAMVec_setstate(self, state):
|
268
|
-
# if "dirty" in state: # backward compat: .dirty was replaced with ._dirty in ModelMember
|
269
|
-
# state['_dirty'] = state['dirty']; del state['dirty']
|
270
|
-
# self.__dict__.update(state)
|
271
|
-
#
|
272
|
-
# dim = _ModuleType("dim")
|
273
|
-
# dim.Dim = dummy_Dim
|
274
|
-
# _sys.modules['pygsti.baseobjs.dim'] = dim
|
275
|
-
#
|
276
|
-
# #_objs.basis.saved_Basis = _objs.basis.Basis
|
277
|
-
# #_objs.basis.Basis = dummy_Basis
|
278
|
-
# _objs.basis.Basis.__setstate__ = Basis_setstate
|
279
|
-
# _circuits.circuit.Circuit.__setstate__ = Circuit_setstate
|
280
|
-
# _objs.labeldicts.StateSpaceLabels.__setstate__ = StateSpaceLabels_setstate
|
281
|
-
# _circuits.circuit.CompressedCircuit.saved_expand = pygsti.circuits.circuit.CompressedCircuit.expand
|
282
|
-
# _circuits.circuit.CompressedCircuit.expand = Hack_CompressedCircuit_expand
|
283
|
-
# _objs.spamvec.SPAMVec.__setstate__ = SPAMVec_setstate
|
284
|
-
#
|
285
|
-
# if old_version < totup("0.9.9"):
|
286
|
-
#
|
287
|
-
# def SPAMVec_setstate(self, state):
|
288
|
-
# #Note: include "dirty"
|
289
|
-
# if old_version <= totup("0.9.7.1"): # b/c this clobbers older-version upgrade
|
290
|
-
# if "dirty" in state: # backward compat: .dirty was replaced with ._dirty in ModelMember
|
291
|
-
# state['_dirty'] = state['dirty']; del state['dirty']
|
292
|
-
# if "_prep_or_effect" not in state:
|
293
|
-
# state['_prep_or_effect'] = "unknown"
|
294
|
-
# if "base1D" not in state and 'base' in state:
|
295
|
-
# state['base1D'] = state['base'].flatten()
|
296
|
-
# del state['base']
|
297
|
-
#
|
298
|
-
# self.__dict__.update(state)
|
299
|
-
#
|
300
|
-
# #HERE TODO: need to remake/add ._reps to all spam & operation objects
|
301
|
-
#
|
302
|
-
# _objs.spamvec.SPAMVec.__setstate__ = SPAMVec_setstate
|
303
|
-
#
|
304
|
-
# # Compatibility with refactored `baseobjs` API
|
305
|
-
# _sys.modules['pygsti.baseobjs.smartcache'] = _objs.smartcache
|
306
|
-
# _sys.modules['pygsti.baseobjs.verbosityprinter'] = _objs.verbosityprinter
|
307
|
-
# _sys.modules['pygsti.baseobjs.profiler'] = pygsti.baseobjs.profiler
|
308
|
-
# _sys.modules['pygsti.baseobjs.protectedarray'] = _objs.protectedarray
|
309
|
-
# _sys.modules['pygsti.baseobjs.objectivefns'] = pygsti.objectivefns.objectivefns
|
310
|
-
# _sys.modules['pygsti.baseobjs.basis'] = _objs.basis
|
311
|
-
# _sys.modules['pygsti.baseobjs.label'] = _objs.label
|
312
|
-
#
|
313
|
-
# if old_version < totup("0.9.9.1"):
|
314
|
-
#
|
315
|
-
# def DenseOperator_setstate(self, state):
|
316
|
-
# if "base" in state:
|
317
|
-
# del state['base']
|
318
|
-
# self.__dict__.update(state)
|
319
|
-
#
|
320
|
-
# def DenseSPAMVec_setstate(self, state):
|
321
|
-
# if old_version <= totup("0.9.9"): # b/c this clobbers (or shadows) older-version upgrade
|
322
|
-
# if old_version <= totup("0.9.7.1"): # b/c this clobbers older-version upgrade
|
323
|
-
# if "dirty" in state: # backward compat: .dirty was replaced with ._dirty in ModelMember
|
324
|
-
# state['_dirty'] = state['dirty']; del state['dirty']
|
325
|
-
# if "_prep_or_effect" not in state:
|
326
|
-
# state['_prep_or_effect'] = "unknown"
|
327
|
-
# if "base1D" not in state and 'base' in state:
|
328
|
-
# state['base1D'] = state['base'].flatten()
|
329
|
-
# del state['base']
|
330
|
-
#
|
331
|
-
# if "base" in state:
|
332
|
-
# del state['base']
|
333
|
-
# if "base1D" in state:
|
334
|
-
# del state['base1D']
|
335
|
-
# self.__dict__.update(state)
|
336
|
-
#
|
337
|
-
# _objs.spamvec.DenseSPAMVec.__setstate__ = DenseSPAMVec_setstate
|
338
|
-
# _objs.operation.DenseOperator.__setstate__ = DenseOperator_setstate
|
339
|
-
#
|
340
|
-
# yield # body of context-manager block
|
341
|
-
#
|
342
|
-
# if old_version <= totup("0.9.6"):
|
343
|
-
# del _sys.modules['pygsti.objects.gatestring']
|
344
|
-
# del _sys.modules['pygsti.objects.gateset']
|
345
|
-
# del _sys.modules['pygsti.objects.gate']
|
346
|
-
# del _sys.modules['pygsti.objects.gatematrixcalc']
|
347
|
-
# del _sys.modules['pygsti.objects.autogator']
|
348
|
-
# #del _sys.modules['pygsti.objects.gatestringstructure']
|
349
|
-
#
|
350
|
-
# del _sys.modules['pygsti.objects.spamvec'].LindbladParameterizedSPAMVec
|
351
|
-
# del _sys.modules['pygsti.objects.spamvec'].FullyParameterizedSPAMVec
|
352
|
-
# del _sys.modules['pygsti.objects.spamvec'].CPTPParameterizedSPAMVec
|
353
|
-
# del _sys.modules['pygsti.objects.spamvec'].TPParameterizedSPAMVec
|
354
|
-
#
|
355
|
-
# del _sys.modules['pygsti.objects.povm'].LindbladParameterizedPOVM
|
356
|
-
#
|
357
|
-
# delattr(_objs.Circuit, '__setstate__')
|
358
|
-
# delattr(_objs.LindbladDenseOp, '__setstate__')
|
359
|
-
# delattr(_objs.modelmember.ModelMember, '__setstate__')
|
360
|
-
#
|
361
|
-
# if old_version <= totup("0.9.7.1"):
|
362
|
-
# del _sys.modules['pygsti.baseobjs.dim']
|
363
|
-
# delattr(_objs.Basis, '__setstate__')
|
364
|
-
# delattr(_objs.labeldicts.StateSpaceLabels, '__setstate__')
|
365
|
-
# if hasattr(_objs.Circuit, '__setstate__'): # b/c above block may have already deleted this
|
366
|
-
# delattr(_objs.Circuit, '__setstate__')
|
367
|
-
# pygsti.circuits.circuit.CompressedCircuit.expand = pygsti.circuits.circuit.CompressedCircuit.saved_expand
|
368
|
-
# delattr(pygsti.circuits.circuit.CompressedCircuit, 'saved_expand')
|
369
|
-
# delattr(_objs.spamvec.SPAMVec, '__setstate__')
|
370
|
-
#
|
371
|
-
# if old_version < totup("0.9.9"):
|
372
|
-
# if hasattr(_objs.spamvec.SPAMVec, '__setstate__'): # b/c above block may have already deleted this
|
373
|
-
# delattr(_objs.spamvec.SPAMVec, '__setstate__')
|
374
|
-
#
|
375
|
-
# del _sys.modules['pygsti.baseobjs.smartcache']
|
376
|
-
# del _sys.modules['pygsti.baseobjs.verbosityprinter']
|
377
|
-
# del _sys.modules['pygsti.baseobjs.profiler']
|
378
|
-
# del _sys.modules['pygsti.baseobjs.protectedarray']
|
379
|
-
# del _sys.modules['pygsti.baseobjs.objectivefns']
|
380
|
-
# del _sys.modules['pygsti.baseobjs.basis']
|
381
|
-
# del _sys.modules['pygsti.baseobjs.label']
|
382
|
-
#
|
383
|
-
# if old_version < totup("0.9.9.1"):
|
384
|
-
# delattr(_objs.spamvec.DenseSPAMVec, '__setstate__')
|
385
|
-
# delattr(_objs.operation.DenseOperator, '__setstate__')
|
@@ -1,142 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#UNUSED - I think we can remove this
|
4
|
-
#class DensePOVMEffect(_POVMEffect):
|
5
|
-
# """
|
6
|
-
# A POVM effect vector that behaves like a numpy array.
|
7
|
-
#
|
8
|
-
# This class is the common base class for parameterizations of an effect vector
|
9
|
-
# that have a dense representation and can be accessed like a numpy array.
|
10
|
-
#
|
11
|
-
# Parameters
|
12
|
-
# ----------
|
13
|
-
# vec : numpy.ndarray
|
14
|
-
# The effect vector as a dense numpy array.
|
15
|
-
#
|
16
|
-
# evotype : EvoType
|
17
|
-
# The evolution type.
|
18
|
-
#
|
19
|
-
# Attributes
|
20
|
-
# ----------
|
21
|
-
# _base_1d : numpy.ndarray
|
22
|
-
# Direct access to the underlying 1D array.
|
23
|
-
#
|
24
|
-
# base : numpy.ndarray
|
25
|
-
# Direct access the the underlying data as column vector,
|
26
|
-
# i.e, a (dim,1)-shaped array.
|
27
|
-
# """
|
28
|
-
#
|
29
|
-
# def __init__(self, vec, evotype):
|
30
|
-
# #dtype = complex if evotype == "statevec" else 'd'
|
31
|
-
# vec = _np.asarray(vec, dtype='d')
|
32
|
-
# vec.shape = (vec.size,) # just store 1D array flatten
|
33
|
-
# vec = _np.require(vec, requirements=['OWNDATA', 'C_CONTIGUOUS'])
|
34
|
-
# evotype = _Evotype.cast(evotype)
|
35
|
-
# rep = evotype.create_dense_effect_rep(vec)
|
36
|
-
# super(DensePOVMEffect, self).__init__(rep, evotype)
|
37
|
-
# assert(self._base_1d.flags['C_CONTIGUOUS'] and self._base_1d.flags['OWNDATA'])
|
38
|
-
#
|
39
|
-
# def to_dense(self, scratch=None):
|
40
|
-
# """
|
41
|
-
# Return this effect vector as a (dense) numpy array.
|
42
|
-
#
|
43
|
-
# The memory in `scratch` maybe used when it is not-None.
|
44
|
-
#
|
45
|
-
# Parameters
|
46
|
-
# ----------
|
47
|
-
# scratch : numpy.ndarray, optional
|
48
|
-
# scratch space available for use.
|
49
|
-
#
|
50
|
-
# Returns
|
51
|
-
# -------
|
52
|
-
# numpy.ndarray
|
53
|
-
# """
|
54
|
-
# #don't use scratch since we already have memory allocated
|
55
|
-
# return self._base_1d # *must* be a numpy array for Cython arg conversion
|
56
|
-
#
|
57
|
-
# @property
|
58
|
-
# def _base_1d(self):
|
59
|
-
# """
|
60
|
-
# Direct access to the underlying 1D array.
|
61
|
-
# """
|
62
|
-
# return self._rep.base
|
63
|
-
#
|
64
|
-
# @property
|
65
|
-
# def base(self):
|
66
|
-
# """
|
67
|
-
# Direct access the the underlying data as column vector, i.e, a (dim,1)-shaped array.
|
68
|
-
# """
|
69
|
-
# bv = self._base_1d.view()
|
70
|
-
# bv.shape = (bv.size, 1) # 'base' is by convention a (N,1)-shaped array
|
71
|
-
# return bv
|
72
|
-
#
|
73
|
-
# def __copy__(self):
|
74
|
-
# # We need to implement __copy__ because we defer all non-existing
|
75
|
-
# # attributes to self.base (a numpy array) which *has* a __copy__
|
76
|
-
# # implementation that we don't want to use, as it results in just a
|
77
|
-
# # copy of the numpy array.
|
78
|
-
# cls = self.__class__
|
79
|
-
# cpy = cls.__new__(cls)
|
80
|
-
# cpy.__dict__.update(self.__dict__)
|
81
|
-
# return cpy
|
82
|
-
#
|
83
|
-
# def __deepcopy__(self, memo):
|
84
|
-
# # We need to implement __deepcopy__ because we defer all non-existing
|
85
|
-
# # attributes to self.base (a numpy array) which *has* a __deepcopy__
|
86
|
-
# # implementation that we don't want to use, as it results in just a
|
87
|
-
# # copy of the numpy array.
|
88
|
-
# cls = self.__class__
|
89
|
-
# cpy = cls.__new__(cls)
|
90
|
-
# memo[id(self)] = cpy
|
91
|
-
# for k, v in self.__dict__.items():
|
92
|
-
# setattr(cpy, k, _copy.deepcopy(v, memo))
|
93
|
-
# return cpy
|
94
|
-
#
|
95
|
-
# #Access to underlying array
|
96
|
-
# def __getitem__(self, key):
|
97
|
-
# self.dirty = True
|
98
|
-
# return self.base.__getitem__(key)
|
99
|
-
#
|
100
|
-
# def __getslice__(self, i, j):
|
101
|
-
# self.dirty = True
|
102
|
-
# return self.__getitem__(slice(i, j)) # Called for A[:]
|
103
|
-
#
|
104
|
-
# def __setitem__(self, key, val):
|
105
|
-
# self.dirty = True
|
106
|
-
# return self.base.__setitem__(key, val)
|
107
|
-
#
|
108
|
-
# def __getattr__(self, attr):
|
109
|
-
# #use __dict__ so no chance for recursive __getattr__
|
110
|
-
# if '_rep' in self.__dict__: # sometimes in loading __getattr__ gets called before the instance is loaded
|
111
|
-
# ret = getattr(self.base, attr)
|
112
|
-
# else:
|
113
|
-
# raise AttributeError("No attribute:", attr)
|
114
|
-
# self.dirty = True
|
115
|
-
# return ret
|
116
|
-
#
|
117
|
-
# #Mimic array
|
118
|
-
# def __pos__(self): return self.base
|
119
|
-
# def __neg__(self): return -self.base
|
120
|
-
# def __abs__(self): return abs(self.base)
|
121
|
-
# def __add__(self, x): return self.base + x
|
122
|
-
# def __radd__(self, x): return x + self.base
|
123
|
-
# def __sub__(self, x): return self.base - x
|
124
|
-
# def __rsub__(self, x): return x - self.base
|
125
|
-
# def __mul__(self, x): return self.base * x
|
126
|
-
# def __rmul__(self, x): return x * self.base
|
127
|
-
# def __truediv__(self, x): return self.base / x
|
128
|
-
# def __rtruediv__(self, x): return x / self.base
|
129
|
-
# def __floordiv__(self, x): return self.base // x
|
130
|
-
# def __rfloordiv__(self, x): return x // self.base
|
131
|
-
# def __pow__(self, x): return self.base ** x
|
132
|
-
# def __eq__(self, x): return self.base == x
|
133
|
-
# def __len__(self): return len(self.base)
|
134
|
-
# def __int__(self): return int(self.base)
|
135
|
-
# def __long__(self): return int(self.base)
|
136
|
-
# def __float__(self): return float(self.base)
|
137
|
-
# def __complex__(self): return complex(self.base)
|
138
|
-
#
|
139
|
-
# def __str__(self):
|
140
|
-
# s = "%s with dimension %d\n" % (self.__class__.__name__, self.dim)
|
141
|
-
# s += _mt.mx_to_string(self.to_dense(), width=4, prec=2)
|
142
|
-
# return s
|
File without changes
|
File without changes
|