Created
March 24, 2015 20:32
-
-
Save amkatrutsa/321466696da1e358c250 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # First variant | |
| term_1 = x | |
| for k in xrange(2): | |
| print "Num iteration", k | |
| Wx = x | |
| for i in xrange(k+1): | |
| Wx = W.dot(Wx) | |
| WTWx = Wx | |
| for i in xrange(k+1): | |
| WTWx = W.T.dot(WTWx) | |
| term_1 = term_1 + WTWx | |
| # Second variant | |
| term_1 = scsp.csr_matrix((n,1)) | |
| for k in xrange(2): | |
| print "Num iteration", k | |
| Wx = x | |
| for i in xrange(k): | |
| Wx = W.dot(Wx) | |
| WTWx = Wx | |
| for i in xrange(k): | |
| WTWx = W.T.dot(WTWx) | |
| term_1 = term_1 + WTWx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment