Codercise D.4.1

Hello,
I get the error “The fidelity of a state with itself should be one.”. Despite writing what I believe to be a correct implementation (it works for the following codercises)

##################
# YOUR CODE HERE #
##################

# RETURN THE FIDELITY
return np.abs(np.inner(phi, psi))

Thanks

Hi @yoshypdf ,
I can see that you’ve got a mistake in your code. I recommend looking up the definition for np.inner and seeing what may need to change when you’re using complex numbers. I hope this helps!

1 Like

Thanks for your help, indeed the problem was with np.inner.

1 Like