Sparse-dense conversion and diagonalization of dense matrices