The first step consists of finding the unitary transformation U diagonalizing H 0 . Since each block H 0 i can be diagonalized with a unitary transformation U i (this is the matrix of right-eigenvectors of H 0 i ), it is enough to build U = diag ⁡ ⁡ ( U i ) , composed of the smaller rotations U i on its diagonal, to transform H 0 into a purely diagonal matrix D 0 = diag ⁡ ⁡ ( d i ) .