-
Notifications
You must be signed in to change notification settings - Fork 57
WIP: leakage-aware GST #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
f422726
to
2f23347
Compare
Text from an email Piper sent (not showing plots since they contained real data):
I think the solution here is just to make sure that the first iteration of leakage-aware GST uses L=2 instead of L=1. (Or, more generally, we use the smallest L where N_s > N_p.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving file-level comments so @coreyostrove and I can figure out what to split out from this PR.
pygsti/circuits/circuit.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is needed for correctness; it's not leakage-specific.
pygsti/data/dataset.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in 42f0cf3 (the date is misleading because I force-pushed) is not leakage-specific and seems worth keeping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes needed for leakage analysis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small changes needed for leakage analysis (could be needed in other contexts).
pygsti/tools/basistools.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes needed for leakage analysis.
pygsti/tools/jamiolkowski.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not leakage-specific, but necessary for leakage analysis.
pygsti/tools/sdptools.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes needed for leakage analysis, and useful more broadly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not leakage-specific
test/unit/tools/test_optools.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modest tests for code used in leakage analysis
""" | ||
povm_mx = compute_povm_map(model, povmlbl) | ||
target_povm_mx = compute_povm_map(target_model, povmlbl) | ||
return diamonddist(povm_mx, target_povm_mx, target_model.basis) | ||
try: | ||
povm_mx = compute_povm_map(model, povmlbl) | ||
target_povm_mx = compute_povm_map(target_model, povmlbl) | ||
return diamonddist(povm_mx, target_povm_mx, target_model.basis) | ||
except AssertionError as e: | ||
assert '`dim` must be a perfect square' in str(e) | ||
return _np.NaN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been included in PR #615
tr = _np.sum(evals) | ||
if abs(tr - 1) > __VECTOR_TOL__: | ||
message = f""" | ||
The PSD part of the input matrix is not trace-1 up to tolerance {__VECTOR_TOL__}. | ||
Beware result! | ||
""" | ||
_warnings.warn(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been included in PR #615
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no subclasses of ModelMemberGraph, so the classmethod should be a staticmethod.
pygsti/modelmembers/povms/tppovm.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Figuring this one out was a doozy. I'm certain that I could make a test which caused the existing code to break without doing anything leakage-specific.
…inearOperator (not just plain numpy ndarrays)
…frobenius norm computation. Bugfix in test_optools.py.
…lots of in-line comments explaining the logic.
…anch that omitted jac as a keyword argument to scipy.minimize, even if jac was None.
…nt fidelity from the calculation of that metric itself. This makes it easier to reuse the setup code in other metrics. While making this change, also make the setup more efficient by using TensorProduct bases from the beginning.
…elf` and make it a static method.
…eterizations on non-qubit spaces (for example, qutrit spaces) by changing the default error generator basis.
…n from ConfidenceRegionFactoryView.compute_confidence_interval(...) function, moving it to its own public instance method.
…ed to be a classmethod; reverted to a staticmethod
…kage.py. Move some functions from optools.py into this new file. Still need to trim down pygsti/tools/leakage.py
…from optools.py into leakage.py
…es we had should not be needed if we define proper functions for handling gauge optimization
…ly basis. Only needed to update the .elements field of the ExplicitBasis that is the leakage-friendly-basis (to be an ndarray with ndim==3 rather than a list of ndarrays of ndim==2), and to change the default convert_to for gauge optimization to "full" instead of "full TP".
…norm tests on Windows
TODOs
changebasis_3level_model and changebasis_3level_results (maybe). Decided against this. These functions didn't just change basis. They also changed model parameterization.Leakage analysis that's important, but out of scope for this PR.