def example(D):
    """Eigenvalues and -vectors, based on SVD."""
u, s, v = np.linalg.svd(D, full_matrices=False)
return np.diag(s) ** 2, u
if __name__ == '__main__':
    data = np.random.rand(5, 20)
data = _cas(data)
eigenvals, eigenvecs = example(data)
print(eigenvals)
print(eigenvecs)
Python: Equivalent to Matlab's svds(A, k) for large arrays?