def _truncated_power_method(self, A, x0, k, max_iter=10000, thresh=1e-8):
        '''
        given a matrix A, an initial guess x0, and a maximum cardinality k,
        find the best k-sparse approximation to its dominant eigenvector

        References
        ----------
        [1] Yuan, X-T. and Zhang, T. "Truncated Power Method for Sparse Eigenvalue Problems."
        Journal of Machine Learning Research. Vol. 14. 2013.
        http://www.jmlr.org/papers/volume14/yuan13a/yuan13a.pdf
        '''

        xts = [x0]
        for t in range(max_iter):
            xts.append(self._normalize(self._truncate(np.dot(A, xts[-1]), k)))
            if np.linalg.norm(xts[-1] - xts[-2]) < thresh: break
        return xts[-1]
given a matrix A, an initial guess x0, and a maximum cardinality k,
        find the best k-sparse approximation to its dominant eigenvector

        References
        ----------
        [1] Yuan, X-T. and Zhang, T. "Truncated Power Method for Sparse Eigenvalue Problems."
        Journal of Machine Learning Research. Vol. 14. 2013.
        http://www.jmlr.org/papers/volume14/yuan13a/yuan13a.pdf