Use this topic to ask your questions about the PennyLane Challenge: Quantum state discrimination.
Hello,
Can someone help me improve my solution by giving me a hint ?
Here is my code
# Put your code here
ket_0 = np.array([1, 0])
ket_1 = np.array([0, 1])
phi_1 = np.cos(theta_1)*ket_0 + np.sin(theta_1)*ket_1
phi_2 = np.cos(theta_2)*ket_0 + np.sin(theta_2)*ket_1
# contruct the average of the two vectors
mid = p_1*phi_1+p_2*phi_2
mid = mid/np.linalg.norm(mid)
def rot(ang, vec):
rot_mat = np.array([[np.cos(ang), -np.sin(ang)],
[np.sin(ang), np.cos(ang)]])
rot_vec = np.dot(rot_mat, vec)
return rot_vec
# new measurement basis (closest to our input states)
new_0 = rot(-np.pi/4, mid)
new_1 = rot(np.pi/4, mid)
q_1 = np.dot(phi_1, new_0)**2
q_2 = np.dot(phi_2, new_1)**2
# Return the highest probability of distinguishing the states
return p_1*q_1 + p_2*q_2
Thanks
Hi @yoshypdf ,
How about using a quantum circuit and an optimization routine?