Quantum Algorithms, Quantum Computing, Physics, Mathematics, Education.
accumulator += eig_vals[i] # calculate density matrix predicted_state = np.zeros((2 ** n, 2 ** n), 'complex') for idx, lamb_val in enumerate(lamb_vals): predicted_state += lamb_vals[idx] * np.outer(eig_vecs[idx], eig_vecs[idx].conj()) return predicted_state Here, the matrix μ is the density matrix