This partially reverts #36 following a comment by @BacAmorim .
The idea of #36 was to wrap the work matrix for bloch! in Hermitian. When passed to diagonalize, the Hermitian wrapper signaled the intent to obtain real eigenvalues. Part of the criticism (slow diagonalization with Hermitian wrappers) does not apply in recent versions of Julia, but nevertheless, the whole Hermitian design seemed unnecessary.
In this PR we no longer force a Hermitian wrapper on the output of bloch!. We allow diagonalize to return complex or real eigenvalues (this depends on the package used). However, when grouping all eigenvalues/vectors into subbands we force a conversion of eigenvalues to their real part only if momenta are real, or make them complex if momenta are complex. The result are subband meshes with vertices (k, ϵ) of uniform type.
Of course, the usual situation is to provide bandstructure with a mesh of real momenta, so eigenvalues will typically be truncated to their real part. It is up to the user (using future API extensions) to provide a complex momentum mesh if one is dealing with bandstructures of non-hermitian Hamiltonians and one needs to preserve the information of the imaginary energies. This design seems overall more sane to me, and does not impose such a bias towards the hermitian case.
This partially reverts #36 following a comment by @BacAmorim .
The idea of #36 was to wrap the work matrix for
bloch!
inHermitian
. When passed todiagonalize
, theHermitian
wrapper signaled the intent to obtain real eigenvalues. Part of the criticism (slow diagonalization withHermitian
wrappers) does not apply in recent versions of Julia, but nevertheless, the whole Hermitian design seemed unnecessary.In this PR we no longer force a Hermitian wrapper on the output of
bloch!
. We allowdiagonalize
to return complex or real eigenvalues (this depends on the package used). However, when grouping all eigenvalues/vectors into subbands we force a conversion of eigenvalues to their real part only if momenta are real, or make them complex if momenta are complex. The result are subband meshes with vertices (k, ϵ) of uniform type.Of course, the usual situation is to provide
bandstructure
with a mesh of real momenta, so eigenvalues will typically be truncated to their real part. It is up to the user (using future API extensions) to provide a complex momentum mesh if one is dealing with bandstructures of non-hermitian Hamiltonians and one needs to preserve the information of the imaginary energies. This design seems overall more sane to me, and does not impose such a bias towards the hermitian case.