Closed pulquero closed 3 years ago
Could also add a spectrum_only param to skip the eigenvectors as they aren't required for some stuff.
Thanks for the suggestions! Reusing the memory is definitely a good idea. Care to make a PR?
I'm less sure about a spectrum_only
parameter. In general, adding parameters adds complexity. In most cases, the eigendecomposition is to be avoided altogether. Which cases are you thinking about where we'd want the eigenvalues but not the eigenvectors? Also, the computational cost isn't reduced and the memory must be available for L.toarray()
anyway.
Btw, I have an implementation of graphwave (about 10 lines), if that would also be of interest.
Let's discuss that in #97.
compute_fourier_basis uses self._e, self._U = np.linalg.eigh(self.L.toarray()) this could be replaced with scipy.linalg.eigh(self.L.toarray(), overwrite_a=True) to reuse the memory used by the output of self.L.toarray().