Hope I am not overreaching with the questions. I am trying my best with all the tests.
##################
# YOUR CODE HERE #
##################
b=pair_circuit(x_tilde, combo)
a=np.kron(x_tilde,b)
c=np.kron(x_tilde,[0,1])
np.isclose(a,c)
@Vedant_Dwivedi, I think probably you are overreaching the question. All you need to do is to compare the output from pair_circuit(x_tilde, combo)
with the expected output: np.array([0., 1.])
using np.isclose()
. End your search once this is true.
That’s right @gidu!
You don’t even need to use np.isclose()
with the full array. Remember that pair_circuit()
gives you the probabilities of measuring ‘0’ and ‘1’ in the last wire. When the probability of measuring ‘1’ is high (close to 1) it means that we have a solution. So you really just need to exit the loop when you get a solution.
I hope this helps @Vedant_Dwivedi!
Hey @CatalinaAlbornoz, I am stuck on this same question. I find the output of measuring a |1> from pair_circuit()
and use np.isclose()
to check if that is close to 1.
I am getting the error: Incorrect: the lock picker doesn’t seem to be working just yet, even though the circuit run and the output is For 4 bits, it takes 4.238 pair tests on average.
Here is my code:
probs = pair_circuit(x_tilde, combo)
if np.isclose(probs[1], 1):
break
Is there something obvious that I am missing? Your help is much appreciated.
Hi @Kamal_Mohamed,
Your code actually works for me. You may have an issue with indents or something else. But congratulations on getting the right code!
It seemed to be the indents that was the issue (even though the code was running). Thank you!