Created
January 17, 2012 17:52
-
-
Save danhammer/1627819 to your computer and use it in GitHub Desktop.
timing matrix multiplication
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
import numpy as np | |
def test_my_mult(n): | |
A = np.random.rand(n*23).reshape(n,23) | |
At = A.T | |
t0 = time.time() | |
res = np.dot(A.T, A) | |
print time.time() - t0 | |
print np.shape(res) | |
return res | |
# Example (returns a 23x23 matrix): | |
# >>> results = test_my_mult(1000000) | |
# | |
# 0.906938076019 | |
# (23, 23) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment