Invariant subspaces and PCA in nearly matrix multiplication time