Skip to content

Commit 11e6ea0

Browse files
Revert "merged develop"
This reverts commit 744f055, reversing changes made to 074c743.
1 parent 3349265 commit 11e6ea0

File tree

130 files changed

+10557
-1971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+10557
-1971
lines changed

Diff for: .github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pygsti/algorithms/compilers.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeep
3737
pygsti/algorithms/mirroring.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers
3838
pygsti/algorithms/randomcircuit.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers
3939
pygsti/algorithms/rbfit.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers
40+
pygsti/extras/rb.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers # Should this just be deprecated and removed?
4041
pygsti/protocols/rb.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers
4142
pygsti/tools/rbtheory.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers
4243
pygsti/tools/rbtools.py @sandialabs/pygsti-rb @sandialabs/pygsti-gatekeepers

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,3 @@ scripts/profiling/data
145145
############################
146146
local
147147
pygsti/_version.py
148-
1_1.profile/0.prof

Diff for: CHANGELOG

-36
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,5 @@
11
# CHANGELOG
22

3-
## [0.9.13] - 2025-01-16
4-
5-
### Added
6-
* PyTorch-backed forward simulation (#390)
7-
* Support for ECR gates in QASM translation (#440, #457)
8-
* Interleaved RB (#296, #468)
9-
* Pared-down Levenberg-Marquardt for nonlinear least-squares (#500)
10-
* Fisher information for quantum instruments (#464, #503)
11-
* Wildcard and Hessians for non-ExplicitOpModels (#511)
12-
13-
### Fixed
14-
* Kraus operator decomposition with degenerate Choi matrix bugfix (#423)
15-
* NumPy improvements and fixes (#430, #431, #451, #458, #470, #518)
16-
* Model parameter desync bugfix (#456, #482)
17-
* FOGI parameter label accumulation bugfix (#486, #488)
18-
* Guarding `signal` to allow PyGSTi usage with Dask (#489)
19-
* Docstring escape and mismatch bugfixes (#502, #504)
20-
* CPTP deserialization sign flip bugfix (#341, #509)
21-
* LindbladErrorgen Hessian with dense representation bugfix (#512)
22-
* Test file updates (#510)
23-
* ProcessorSpec state space label bugfix (#474, #521)
24-
25-
### Changed
26-
* Circuit primitive performance upgrades (#445)
27-
* Refactors for matrixtools.py and the Basis class (#429, #442, #493)
28-
* Layout and MDCStore creation performance upgrades (#448)
29-
* Major 2Q GST performance improvements (#496, #517)
30-
31-
### Deprecated
32-
* We are deprecating the CVXOPT backend for CVXPY in favor of Clarabel (#437). Although pyGSTi will not warn you if you continue to use the CVXOPT backend, this change will occur with no additional warning in a future release.
33-
34-
### Removed
35-
* Removed explicit dependency on CVXOPT for wildcard optimization (#444)
36-
* Removed deprecated QIBO interface (#262, #490)
37-
* Large "spring cleaning" of unused/commented out code (#424, #452)
38-
393
## [0.9.12.3] - 2024-06-11
404

415
### Added

Diff for: README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
********************************************************************************
2-
pyGSTi 0.9.13
2+
pyGSTi 0.9.12.1
33
********************************************************************************
44

5-
[![master build](https://img.shields.io/github/actions/workflow/status/sandialabs/pyGSTi/beta-master.yml?branch=master&label=master)](https://github.com/sandialabs/pyGSTi/actions/workflows/beta-master.yml)
6-
[![develop build](https://img.shields.io/github/actions/workflow/status/sandialabs/pyGSTi/develop.yml?branch=develop&label=develop)](https://github.com/sandialabs/pyGSTi/actions/workflows/develop.yml)
7-
[![beta build](https://img.shields.io/github/actions/workflow/status/sandialabs/pyGSTi/beta-master.yml?branch=beta&label=beta)](https://github.com/sandialabs/pyGSTi/actions/workflows/beta-master.yml)
5+
![master build](https://github.com/pyGSTio/pyGSTi/workflows/Build%20and%20run%20tests/badge.svg?branch=master)
6+
![develop build](https://github.com/pyGSTio/pyGSTi/workflows/Build%20and%20run%20tests/badge.svg?branch=develop)
7+
![beta build](https://github.com/pyGSTio/pyGSTi/workflows/Build%20and%20run%20test%20extras/badge.svg?branch=beta)
8+
![notebooks on beta](https://github.com/pyGSTio/pyGSTi/workflows/Build%20and%20run%20notebook%20regression/badge.svg?branch=beta)
89

910
pyGSTi
1011
------

Diff for: pygsti/algorithms/core.py

+2
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,8 @@ def find_closest_unitary_opmx(operation_mx):
11491149
# d = _np.sqrt(operation_mx.shape[0])
11501150
# I = _np.identity(d)
11511151

1152+
#def getu_1q(basisVec): # 1 qubit version
1153+
# return _spl.expm( 1j * (basisVec[0]*_tools.sigmax + basisVec[1]*_tools.sigmay + basisVec[2]*_tools.sigmaz) )
11521154
def _get_gate_mx_1q(basis_vec): # 1 qubit version
11531155
return _tools.single_qubit_gate(basis_vec[0],
11541156
basis_vec[1],

Diff for: pygsti/algorithms/fiducialselection.py

+7
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@ def final_result_test(final_fids, verb_printer):
409409
return prepFidList, measFidList
410410

411411

412+
#def bool_list_to_ind_list(boolList):
413+
# output = _np.array([])
414+
# for i, boolVal in boolList:
415+
# if boolVal == 1:
416+
# output = _np.append(i)
417+
# return output
418+
412419
def xor(*args):
413420
"""
414421
Implements logical xor function for arbitrary number of inputs.

Diff for: pygsti/algorithms/germselection.py

+78-100
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from pygsti.baseobjs.statespace import ExplicitStateSpace as _ExplicitStateSpace
2828
from pygsti.baseobjs.statespace import QuditSpace as _QuditSpace
2929
from pygsti.models import ExplicitOpModel as _ExplicitOpModel
30-
from pygsti.forwardsims import MatrixForwardSimulator as _MatrixForwardSimulator
3130

3231
FLOATSIZE = 8 # in bytes: TODO: a better way
3332

@@ -58,8 +57,10 @@ def find_germs(target_model, randomize=True, randomization_strength=1e-2,
5857
5958
Parameters
6059
----------
61-
target_model : Model
62-
The model you are aiming to implement.
60+
target_model : Model or list of Model
61+
The model you are aiming to implement, or a list of models that are
62+
copies of the model you are trying to implement (either with or
63+
without random unitary perturbations applied to the models).
6364
6465
randomize : bool, optional
6566
Whether or not to add random unitary perturbations to the model(s)
@@ -187,14 +188,8 @@ def find_germs(target_model, randomize=True, randomization_strength=1e-2,
187188
A list containing the germs making up the germ set.
188189
"""
189190
printer = _baseobjs.VerbosityPrinter.create_printer(verbosity, comm)
190-
191-
if not isinstance(target_model.sim, _MatrixForwardSimulator):
192-
target_model = target_model.copy()
193-
target_model.sim = 'matrix'
194-
195191
modelList = _setup_model_list(target_model, randomize,
196192
randomization_strength, num_gs_copies, seed)
197-
198193
gates = list(target_model.operations.keys())
199194
availableGermsList = []
200195
if candidate_germ_counts is None: candidate_germ_counts = {6: 'all upto'}
@@ -406,19 +401,7 @@ def find_germs(target_model, randomize=True, randomization_strength=1e-2,
406401
raise ValueError("'{}' is not a valid algorithm "
407402
"identifier.".format(algorithm))
408403

409-
#force the line labels on each circuit to match the state space labels for the target model.
410-
#this is suboptimal for many-qubit models, so will probably want to revisit this. #TODO
411-
finalGermList = []
412-
for ckt in germList:
413-
if ckt._static:
414-
new_ckt = ckt.copy(editable=True)
415-
new_ckt.line_labels = target_model.state_space.state_space_labels
416-
new_ckt.done_editing()
417-
finalGermList.append(new_ckt)
418-
else:
419-
ckt.line_labels = target_model.state_space.state_space_labels
420-
finalGermList.append(ckt)
421-
return finalGermList
404+
return germList
422405

423406

424407
def compute_germ_set_score(germs, target_model=None, neighborhood=None,
@@ -1421,10 +1404,6 @@ def test_germ_set_finitel(model, germs_to_test, length, weights=None,
14211404
eigenvalues (from small to large) of the jacobian^T * jacobian
14221405
matrix used to determine parameter amplification.
14231406
"""
1424-
if not isinstance(model.sim, _MatrixForwardSimulator):
1425-
model = model.copy()
1426-
model.sim = 'matrix'
1427-
14281407
# Remove any SPAM vectors from model since we only want
14291408
# to consider the set of *gate* parameters for amplification
14301409
# and this makes sure our parameter counting is correct
@@ -3380,81 +3359,80 @@ def symmetric_low_rank_spectrum_update(update, orig_e, U, proj_U, force_rank_inc
33803359
#return the new eigenvalues
33813360
return new_evals, True
33823361

3383-
# Note: Th function below won't work for our purposes because of the assumptions
3384-
# about the rank of the update on the nullspace of the matrix we're updating,
3385-
# but keeping this here commented for future reference.
3386-
'''
3387-
def riedel_style_inverse_trace(update, orig_e, U, proj_U, force_rank_increase=True):
3388-
"""
3389-
input:
3390-
3391-
update : ndarray
3392-
symmetric low-rank update to perform.
3393-
This is the first half the symmetric rank decomposition s.t.
3394-
[email protected]= the full update matrix.
3395-
3396-
orig_e : ndarray
3397-
Spectrum of the original matrix. This is a 1-D array.
3398-
3399-
proj_U : ndarray
3400-
Projector onto the complement of the column space of the
3401-
original matrix's eigenvectors.
3402-
3403-
output:
3404-
3405-
trace : float
3406-
Value of the trace of the updated psuedoinverse matrix.
3407-
3408-
updated_rank : int
3409-
total rank of the updated matrix.
3410-
3411-
rank_increase_flag : bool
3412-
a flag that is returned to indicate is a candidate germ failed to amplify additional parameters.
3413-
This indicates things short circuited and so the scoring function should skip this germ.
3414-
"""
3415-
3416-
#First we need to for the matrix P, whose column space
3417-
#forms an orthonormal basis for the component of update
3418-
#that is in the complement of U.
3419-
3420-
proj_update= proj_U@update
3421-
3422-
#Next take the RRQR decomposition of this matrix:
3423-
q_update, r_update, _ = _sla.qr(proj_update, mode='economic', pivoting=True)
3424-
3425-
#Construct P by taking the columns of q_update corresponding to non-zero values of r_A on the diagonal.
3426-
nonzero_indices_update= _np.nonzero(_np.diag(r_update)>1e-10) #HARDCODED (threshold is hardcoded)
3427-
3428-
#if the rank doesn't increase then we can't use the Riedel approach.
3429-
#Abort early and return a flag to indicate the rank did not increase.
3430-
if len(nonzero_indices_update[0])==0 and force_rank_increase:
3431-
return None, None, False
3432-
3433-
P= q_update[: , nonzero_indices_update[0]]
3434-
3435-
updated_rank= len(orig_e)+ len(nonzero_indices_update[0])
3436-
3437-
#Now form the matrix R_update which is given by P.T @ proj_update.
3438-
R_update= P.T@proj_update
3439-
3440-
#R_update gets concatenated with U.T@update to form
3441-
#a block column matrixblock_column= np.concatenate([U.T@update, R_update], axis=0)
3442-
3443-
Uta= U.T@update
3444-
3445-
try:
3446-
RRRDinv= R_update@_np.linalg.inv(R_update.T@R_update)
3447-
except _np.linalg.LinAlgError as err:
3448-
print('Numpy thinks this matrix is singular, condition number is: ', _np.linalg.cond(R_update.T@R_update))
3449-
print((R_update.T@R_update).shape)
3450-
raise err
3451-
pinv_orig_e_mat= _np.diag(1/orig_e)
3452-
3453-
trace= _np.sum(1/orig_e) + _np.trace( RRRDinv@(_np.eye(Uta.shape[1]) + Uta.T@pinv_orig_e_mat@Uta)@RRRDinv.T )
3362+
#Note: This function won't work for our purposes because of the assumptions
3363+
#about the rank of the update on the nullspace of the matrix we're updating,
3364+
#but keeping this here commented for future reference.
3365+
#Function for doing fast calculation of the updated inverse trace:
3366+
#def riedel_style_inverse_trace(update, orig_e, U, proj_U, force_rank_increase=True):
3367+
# """
3368+
# input:
3369+
#
3370+
# update : ndarray
3371+
# symmetric low-rank update to perform.
3372+
# This is the first half the symmetric rank decomposition s.t.
3373+
# [email protected]= the full update matrix.
3374+
#
3375+
# orig_e : ndarray
3376+
# Spectrum of the original matrix. This is a 1-D array.
3377+
#
3378+
# proj_U : ndarray
3379+
# Projector onto the complement of the column space of the
3380+
# original matrix's eigenvectors.
3381+
#
3382+
# output:
3383+
#
3384+
# trace : float
3385+
# Value of the trace of the updated psuedoinverse matrix.
3386+
#
3387+
# updated_rank : int
3388+
# total rank of the updated matrix.
3389+
#
3390+
# rank_increase_flag : bool
3391+
# a flag that is returned to indicate is a candidate germ failed to amplify additional parameters.
3392+
# This indicates things short circuited and so the scoring function should skip this germ.
3393+
# """
3394+
#
3395+
# #First we need to for the matrix P, whose column space
3396+
# #forms an orthonormal basis for the component of update
3397+
# #that is in the complement of U.
3398+
#
3399+
# proj_update= proj_U@update
3400+
#
3401+
# #Next take the RRQR decomposition of this matrix:
3402+
# q_update, r_update, _ = _sla.qr(proj_update, mode='economic', pivoting=True)
3403+
#
3404+
# #Construct P by taking the columns of q_update corresponding to non-zero values of r_A on the diagonal.
3405+
# nonzero_indices_update= _np.nonzero(_np.diag(r_update)>1e-10) #HARDCODED (threshold is hardcoded)
3406+
#
3407+
# #if the rank doesn't increase then we can't use the Riedel approach.
3408+
# #Abort early and return a flag to indicate the rank did not increase.
3409+
# if len(nonzero_indices_update[0])==0 and force_rank_increase:
3410+
# return None, None, False
3411+
#
3412+
# P= q_update[: , nonzero_indices_update[0]]
3413+
#
3414+
# updated_rank= len(orig_e)+ len(nonzero_indices_update[0])
3415+
#
3416+
# #Now form the matrix R_update which is given by P.T @ proj_update.
3417+
# R_update= P.T@proj_update
3418+
#
3419+
# #R_update gets concatenated with U.T@update to form
3420+
# #a block column matrixblock_column= np.concatenate([U.T@update, R_update], axis=0)
3421+
#
3422+
# Uta= U.T@update
3423+
#
3424+
# try:
3425+
# RRRDinv= R_update@_np.linalg.inv(R_update.T@R_update)
3426+
# except _np.linalg.LinAlgError as err:
3427+
# print('Numpy thinks this matrix is singular, condition number is: ', _np.linalg.cond(R_update.T@R_update))
3428+
# print((R_update.T@R_update).shape)
3429+
# raise err
3430+
# pinv_orig_e_mat= _np.diag(1/orig_e)
3431+
#
3432+
# trace= _np.sum(1/orig_e) + _np.trace( RRRDinv@(_np.eye(Uta.shape[1]) + Uta.T@pinv_orig_e_mat@Uta)@RRRDinv.T )
3433+
#
3434+
# return trace, updated_rank, True
34543435

3455-
return trace, updated_rank, True
3456-
'''
3457-
34583436
def minamide_style_inverse_trace(update, orig_e, U, proj_U, force_rank_increase=False):
34593437
"""
34603438
This function performs a low-rank update to the components of

0 commit comments

Comments
 (0)