Matrix diagonalization