Here I am getting the error messages as
Blockquote Your code isn't giving the correct probabilities!Your code isn'tgiving the correct probabilities!
My code is as follows:
``
def outcome_probs(rho, B):
"""
Args:
rho (np.array([array[complex]])): The density matrix of the state before measurement
B (np.array([array[complex]])): Matrix representation of the measured observable
Returns:
(np.array(float)): List of measurement probabilities, in no particular order.
"""
eigen_projectors = eigenprojectors(B)# Use a previously defined function to obtain the eigenprojectors
prob_list = np.real(np.trace(np.dot(rho,eigen_projectors)))# Use list comprehension and the relevant formula to find the probabilities
return prob_list
rho = np.array([[3/4,0],[0,1/4]])
B = qml.matrix(qml.PauliY(0))
print(“State: [[3/4,0],[0,1/4]], Observable: {}”.format(B))
print(“Measurement probabilities {}”.format(outcome_probs(rho,B).round(2)))``