-
Notifications
You must be signed in to change notification settings - Fork 342
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
Data structures for specifying input states #770
Conversation
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.
No required changes. Some questions and potential requests that I could be easily talked out of.
Merged in #754 and consolidated some of the functionality. @msohaibalam can you take a look at the new term-grouping changes |
|
||
Given some PauliTerm, the 'natural' tensor product basis (tpb) to |
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 function is now redundant, but this was a good docstring so I put it in group_experiments
so people might actually find it
@@ -287,6 +287,33 @@ def bitphase_flip_operators(p): | |||
'bitphase_flip': bitphase_flip_operators, | |||
} | |||
|
|||
SIC0 = np.array([1, 0]) |
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.
Add a reference so people can check?
I personally use this http://info.phys.unm.edu/~caves/reports/infopovm.pdf see Eqns. 22 and 23
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.
cool; I'll add that in
|
||
|
||
def _generate_random_states(n_qubits, n_terms): | ||
oneq_states = [SIC0, SIC1, SIC2, SIC3, plusX, minusX, plusY, minusY, plusZ, minusZ] |
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.
Im flying blind here, so apologies if this doesn't make sense.
It seems like one might want to generate a random state from the Pauli eigenstates or from the SIC states but not from both.
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 is just for the tests, so it doesn't make perfect sense; but it is something you can do (in code)
def _validate_all_diagonal_in_tpb(ops: Iterable[PauliTerm]) -> Dict[int, str]: | ||
"""Each non-identity qubit should result in the same op_str among all operations. Return | ||
said mapping. | ||
def _max_weight_operator(ops: Iterable[PauliTerm]) -> Union[None, PauliTerm]: |
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 function as well as _max_weight_state(..)
are defined slightly later than their first use (in construct_tpb_graph(..)
); I'd place them immediately before.
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.
I've prioritized readability of the diff
assert expt2.out_operator == oop | ||
|
||
|
||
def test_experiment_no_in(): | ||
def test_setting_no_in_back_compat(): |
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 test as well as test_setting_no_in(..)
both raise the warning message UserWarning: ExperimentSetting.in_operator is deprecated in favor of in_state
. In general, we should try to avoid writing tests that will raise warning messages. If we add the decorator @pytest.mark.filterwarnings("ignore:ExperimentSetting")
to both these tests, we'd have a warning free test output (see https://docs.pytest.org/en/latest/warnings.html)
@mpharrigan I've tested out the (slightly modified) code for the grouping methods explicitly on (a) random experiments, (b) exhaustive experiments, and (c) chemistry experiments (LiH, and BeH2), and the results stay the same as before. So the changes look good to me! |
v1 of
operator_estimation.py
usedPauliTerm
s to specify the input state, which is an abuse of data structures. This PR introduces two new datastructures, the later of which behaves similar toPauliTerm
but for specifying "named" states. You can specify the +/- eigenstates of pauli X,Y,Z or SIC[0-3] for the sic basis.These constructs are necessary for process tomography