# Quantum Circuit to inverse the probability distribution

I'm using Qiskit and after running the circuit, as we all know, we get a count dictionary such as

{'0000': 66,
'0001': 71,
'0010': 68,
'0011': 70,
'0100': 77,
'0101': 64,
'0110': 64,
'0111': 51,
'1000': 52,
'1001': 67,
'1010': 43,
'1011': 64,
'1100': 61,
'1101': 59,
'1110': 73,
'1111': 74}


Here the minimum count is 1010:43. I want the same output just reversed [1024-(count)]. I know this can be achieved by few lines of python, but I was curious if this is possible to do with a quantum circuit?

• The get_counts() methods returns the count of shots that have that particular output. Are you asking for a get_counts_did_not_match? What's your use case in which shots - count is more informative? It can be a feature request in Qiskit... – luciano Nov 26 '20 at 17:12

There is no a way in Qiskit to get the results in that format. So, you will have to go for the pure Python way:

counts = {'0000': 66, '0001': 71, '0010': 68, '0011': 70,
'0100': 77, '0101': 64, '0110': 64, '0111': 51,
'1000': 52, '1001': 67, '1010': 43, '1011': 64,
'1100': 61, '1101': 59, '1110': 73, '1111': 74}

shots = 1024
counts = { k:(shots-v) for k,v in counts.items()}

• So there are no quantum circuit to doing this? – Saptarshi Sahoo Nov 26 '20 at 20:21
• Those numbers (the values in the dict) are the amount of shots that landed in each result. Are you trying to invert the frequency of the results? I'm not sure what you mean by "a quantum circuit that does this". – luciano Nov 26 '20 at 21:35
• What i'm saying is that, that the dict is directly proportional to probability distribution of the final state , i want to know if there is a quantum way to inverse the probability distribution, low becomes high and high becomes low? – Saptarshi Sahoo Nov 27 '20 at 9:43
• Hmm... not sure if that's possible. I might be fully wrong here. Here is my reasoning: Imposible results (with count 0) would turn into fully certain results. There are infinite amount of impossible results (for example, there is an implicit '00100': 0). What's the count those impossible results should have? Even if possible, that operation is fully classical. So probably no need to do it on the circuit. – luciano Dec 3 '20 at 12:37