Hi!
I was trying to run an error mitigation code such that I can get probabilities of all the n_wires
at the end.
But I am getting an error
My aim is to generate error mitigated probabilities using qnode.
Thanks for the help !
Hi!
I was trying to run an error mitigation code such that I can get probabilities of all the n_wires
at the end.
Thanks for the help !
What’s happening here is that the output of your circuit is more than a single number.
If you change your return statement to
return qml.expval(qml.PauliZ(0))
or
return qml.expval(qml.PauliZ(0)@qml.PauliZ(1)@qml.PauliZ(2))
You will see that you no longer find this error.
In this case the expected value of the PauliZ observable is 0 because half the time it will be +1 and half the time it will be -1. If you changed the observable to PauliX then you should get an expected value of 1 for each wire.
I hope this helps!
Thanks for the reply! I think this works but I am not sure that I aim to get this. My aim is to find the original and mitigated probability of a certain string ( say 010 ). Is there any way to do it?
Hi @Pranav_Chandarana, I don’t think there’s an exact measurement you can do but you could add some controlled gates and some additional wires and then measure the expected value on that extra qubit. This way the expected value would indicate the probability of getting that particular string from the other wires.
Please let me know if this is clear! I hope it helps.