Energy measurement (source code)

= Energy measurement

An ideal energy measurement returns an eigenvalue of the Hamiltonian with probability equal to the squared norm of the state's projection onto its eigenspace. After obtaining a nondegenerate energy, the state is the corresponding energy eigenstate.