-
-
Save osdf/2397975 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
#! /usr/bin/env python | |
import numpy | |
import time | |
import scipy.linalg as linalg | |
try: | |
import numpy.core._dotblas | |
print 'Using ATLAS:' | |
except ImportError: | |
print 'No ATLAS:' | |
print numpy.__version__ | |
N = 10 | |
x = numpy.random.random((1000,1000)) | |
y = numpy.random.random((1000,1000)) | |
t = time.time() | |
for i in range(N): | |
numpy.dot(x, y) | |
u = time.time() | |
print 'dot', (u-t) / N | |
z = numpy.dot(x, x.T) + 2*numpy.eye(1000) | |
t = time.time() | |
for i in range(N): | |
c = linalg.svd(z) | |
u = time.time() | |
print 'svd', (u - t) / N | |
t = time.time() | |
for i in range(N): | |
c = linalg.cholesky(z, lower=True) | |
u = time.time() | |
print 'cholesky', (u - t) / N |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment