backport-1.8-3982

Backport #3982: `MAINT: Refactor eigh and eigvalsh and associated tests.`