Created
April 25, 2014 01:37
-
-
Save davidwhogg/11275291 to your computer and use it in GitHub Desktop.
This file contains 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 | |
import time as tt | |
def main(): | |
timing = np.array([]) | |
log2N = np.arange(6) + 8 | |
for N in 2 ** log2N: | |
uu = np.random.normal(size=(N, N+2)) | |
matrix = np.dot(uu, uu.T) | |
print matrix.shape | |
vector = np.random.normal(size=N) | |
print "start %d" % N | |
t1 = tt.time() | |
np.linalg.solve(matrix, vector) | |
timing = np.append(timing, [tt.time() - t1,]) | |
print "end %d" % N | |
print timing | |
print np.polyfit(log2N, np.log(timing)/np.log(2.), 1) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment