For a 2x2 matrix, the smallInverse function does the inversion analytically and incorrectly switches the off-diagonal elements: std::swap(m_inv(1, 0), m_inv(0, 1)); This won't affect problems for which the Hamiltonian is real, but it does affect problems with complex off-diagonal elements.