reorganized implementation of sp_eigs: split into functions for sparse and dense eig functions