0
$\begingroup$

I have an array of qubits, with indices to represent each such that if we have 3 qubits, we have 0, 1, 2 representing each. From here I would like to measure the probability of our qubits after running it through some gates. How can I grab these probabilities and spit out one of the indices based on which has the highest probability?

Cheers!

$\endgroup$
6
  • 1
    $\begingroup$ In general, this is impossible to do via the No-Cloning Theorem, as you can't learn the probability of a measurement from a single copy of that state. May I ask more about the context to help understand your question better? Thanks! $\endgroup$ Aug 6 '20 at 19:43
  • $\begingroup$ How does DumpRegister() work? By No-Cloning Theorem we shouldn't be able to utilize this right? In essence I would like to use DumpRegister but instead of getting visual results, I pick the one with the highest probability and utilize its index value. Context is related to the Durr Hoyer library, specifically QESA, in the last part of the algorithm we must measure the first register, and the qubit with highest probability, where each qubit represents an index, is your min... Utilizing MeasureInteger() is giving back what I believe is Little endian decoding, though this is not what I am after, $\endgroup$
    – Mridul
    Aug 6 '20 at 21:24
  • 1
    $\begingroup$ I'm assuming you mean grab the qubit with the highest probability of reading 1? If so, you could repeatedly measure the qubits and select the one with the highest proportion (though this would be probabilistic). The DumpRegister method could also work, but you'd need an external program to identify the highest probability qubit $\endgroup$
    – C. Kang
    Aug 7 '20 at 0:05
  • $\begingroup$ Oh that is a nice idea actually, I could simply preserve the state of my register, and measure each qubit storing it in a list, then comparing to each other to find the highest probability. I am looking for a probabilistic outcome so I think this would work out. $\endgroup$
    – Mridul
    Aug 7 '20 at 2:59
  • 1
    $\begingroup$ @Mridul: To clarify, simulators need not obey the no-cloning theorem, making it possible to get useful diagnostics when running on a simulator. DumpRegister doesn't violate the no-cloning theorem those diagnostics are displayed directly, and not used to condition the execution of a Q# program. Put differently, a Q# program can't ever "notice" a call to DumpMachine or DumpRegister, such that they can be safely replaced by no-ops on machines where that's not possible. $\endgroup$ Aug 7 '20 at 19:58
1
$\begingroup$

One potential strategy is to probabilistically estimate the qubits' probabilities. Here's some pseudocode:

counts = Int[NumberOfQubits]
for counter in trials:
   ApplyOperationToArray
   results = MeasureArray
   AddResults(results, counts)
idx = maxIdx(counts)

As mentioned in the comments, we cannot ascertain which qubit has the highest probability by the no-cloning theorem. However, this approach also has limitations - namely, the computation will always have a chance for failure!

$\endgroup$

Your Answer

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

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