Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions qsimcirq_tests/qsimcirq_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _mixture_(self):
return [(prob, cirq.unitary(op)) for prob, op, in self._prob_op_pairs]
return [(prob, op) for prob, op, in self._prob_op_pairs]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _mixture a standard protocol for qsim or is this only used for this test? This is changing the return type for this method.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize op was already a np.array.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. It's true that the 2nd element in the tuples in self._prob_op_pairs are actually NoiseStep objects. Lemme see if I can improve this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, with the way this all routed between different functions, I can't find a way to avoid changing this return type without rewriting test_multi_qubit_noise(). Given that this object class is only used in this file and only for that one function, that seems like it would be poor ROI.

I added a comment explaning what is happening. @dstrain115 can you check that it makes sense?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize op was already a np.array.

Actuallly, I was wrong about that in my earlier comment (which I deleted too slowly to save you typing that reply -- sorry about that). At this point in the flow of things, it's not an ndarray. The whole flow is a bit more complicated, which hopefully the new comment clarifies.



@pytest.mark.parametrize(
Expand Down Expand Up @@ -2025,11 +2025,11 @@ def test_qsimcirq_identity_expectation_value():
for w, pauli in objs:
pauli = pauli[::-1]
hamiltonian += float(w) * cirq.PauliString(
cirq.I(cirq.LineQubit(i))
if p == "I"
else cirq.Z(cirq.LineQubit(i))
if p == "Z"
else None
(
cirq.I(cirq.LineQubit(i))
if p == "I"
else cirq.Z(cirq.LineQubit(i)) if p == "Z" else None
)
for i, p in enumerate(pauli)
)

Expand Down
Loading