-
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/algorithms/gaugeopt.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 here ARE leakage-specific and CANNOT be moved to another 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.
Type annotations; not leakage-specific.
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.
Type annotations; not leakage-specific.
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.
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, plus a handful for non-leakage-specific changes.
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
…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.
…imizers. Right now only entanglement fidelity and jtracedist have implementations that can consider leakage. (So there are no leakage-aware metrics for SPAM.)
…dded annotations to all gauage optimization objectives used in the non-LS optimizer, indicating if that particular objective has support for leakage-aware metrics.
… while. The tests only consider when no leakage is modeled. New tests wil be needed for when theres a leakage dimension
… that various gauge optimization functions don`t raise errors.
…. Correct bug in sdptools.py::cptp_superop_variable that showed up when using bases whose first element was the identity (not the case in the leakage-friendly basis)
…eadability improvements.
…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.
""" | ||
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
…ed to be a classmethod; reverted to a staticmethod
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.
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.
TODOs
Leakage analysis that's important, but out of scope for this PR.