block_diagonalize fails to recognize unsimplified sympy Hamiltonians as diagonal
If a user provides a sympy Hamiltonian and subspace_eigenvectors
, it may be that the projected Hamiltonian isn't diagonal only because it wasn't simplified. This raises ValueError: The unperturbed Hamiltonian must be diagonal if ``solve_sylvester`` is not provided.
An easy fix would be to throw in sympy.simplify
in linalg.is_diagonal
, but it would be better if we also simplified the projected Hamiltonian, such that products are easier to compute.