The usual convention is that $Y=\imath XZ$ let's call that the "complex" $Y$ convention; for a number of reasons I prefer to work with $Y=XZ$, the "real" $Y$ convention. Stim works with the complex $Y$ convention; how would I do a $CY$ and $MPP$ in the real convention? I can find workarounds by multiplying by $\imath$ but I didn't see in the documentation how that's done.


1 Answer 1



If you measure Y, you project into a state and stay there:

project and stay

If you measure iY (to the extent that this can be given a meaningful interpretation, since it's not Hermitian), you drift around:


Assuming that's actually what you want, read on...

Stim doesn't have CiY or MPP iY as native operations. You will have to decompose them into operations that Stim does support.

You can decompose a controlled-$iY$ into a $CY$ followed by an $S$ on the control.

# perform CiY 0 1
CY 0 1
S 0

Perhaps more natural is to decompose it into CX*CZ:

# perform CiY 0 1
CX 0 1
CZ 0 1

You can decompose an MPP iY into controlled Pauli operations onto a clean ancilla. You apply an S gate to that ancilla for each of the factors of $i$ you accumulated. So, if the number of factors of $i$ is 1 mod 4, apply S. For 2 mod 4 apply Z. For 3 mod 4 apply S_DAG. For 0 mod 4 do nothing. You then get the measurement result via a demolition measurement of the ancilla.

# perform MPP X0*iY1*Z2
R 999  # clean ancilla
XCX 0 999
YCX 1 999
ZCX 2 999
S 999  # this accounts for the `i` in `iY`
MR 999

Again, it's perhaps more natural to decompose into CX and CZ, as this avoids the need to manually do the S gates:

# perform MPP X0*iY1*Z2
R 999  # clean ancilla
XCX 0 999 1 999
ZCX       1 999 2 999
# factor of i accounted for by X*Z from qubit 1
MR 999

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.