I have the following quantum operation on two qubits: $$ \mathcal{E}(\rho) = p \mathcal{T} \circ \mathcal{U}(\rho) + (1-p) \mathcal{U}(\rho) ​$$

where $p$ is some probability, $\mathcal{U}$ is some unitary operation on the two qubits and $\mathcal{T}$ measures whether both qubits are $1$.

I have the variable $p$ in Python, and I would like to use it to construct a circuit that implements the above. I tried to simply construct a circuit by making Python do the random choices (i.e. insert the measurement with probability $p$), but with this approach I need to recompile a new circuit for each shot, and I was wondering whether there is a simple way to make random choices directly within the QuantumCircuit.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.