Applying projectors with mid-circuit measurements

I am trying to apply a non-unitary projector (see image) to my two-qubit quantum circuit using mid-circuit measurements.

$$\begin{pmatrix} 0 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 0 \ \end{pmatrix}$$

Since I am a bit stumped on whether I can apply this projector to qubits in the middle of the circuit, I am using conditional resets in the following way:

    for i in range(1, t):
#print ('Measuring ' + str(i) + ' times')
#do not apply unitary if the outcome is |00> (1000) or |11> (0001)
qRandWalk.measure(qlist,creg)
qRandWalk.x(qlist[1]).c_if(creg,5) #resets 1001 (|01>) to (1010) |00>
qRandWalk.x(qlist[1]).c_if(creg,10) #resets 0110 (|10>) to (0101) |11>
qRandWalk.append(unitary_operator, qlist).c_if(creg,6) # 6 in binary is 0110, |10>
qRandWalk.append(unitary_operator, qlist).c_if(creg,9) #9 in binary is 1001, |01>



I want to project the measured state onto a subspace, then append the unitary operator to the circuit depending on the measurement outcome. I am not sure whether that is what my current code is doing. Are there any other approaches I can take at the moment, running on QASM simulator?

• The matrix you gave acts on a 5-dimensional system, but a four qubit circuit describes a 16-dimensional system. Could you say a bit more about what this matrix is supposed to be doing? Aug 2 '21 at 22:06