Generalize block diagonalization to >2 blocks
Our general
algorithm right now is almost agnostic to the number of blocks.
Specifically, eliminating V_n
from this equation:
\tilde{H}^{(n)} = \sum_{i=0}^n (U_{n-i} - V_{n-i}) H_0 (U_i + V_i) + \sum_{i=0}^{n-1} (U_{n-i-1} - V_{n-i-1}) H_p (U_i + V_i).
gives a similar Sylvester equation for all blocks of V
.
The unitarity constraint is also generic:
2 U_n = -\sum_{i=1}^{n-1}(U_{n-i}U_i - V_{n-i}V_i)
The only question that isn't clear to me is whether U_n
will turn out to be block-diagonal or dense.