Skip to content

Instantly share code, notes, and snippets.

@sritchie
Forked from danhammer/gist:1627819
Created January 17, 2012 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sritchie/1627929 to your computer and use it in GitHub Desktop.
Save sritchie/1627929 to your computer and use it in GitHub Desktop.
timing matrix multiplication
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