python 测试numpy和scipy设置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 测试numpy和scipy设置相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env python                                                           
import timeit


setup = "import numpy;\
        import scipy.linalg as linalg;\
        x = numpy.random.random((1000,1000));\
        z = numpy.dot(x, x.T)"
count = 5

t = timeit.Timer("linalg.cholesky(z, lower=True)", setup=setup)
print "cholesky:", t.timeit(count)/count, "sec"

t = timeit.Timer("linalg.svd(z)", setup=setup)
print "svd:", t.timeit(count)/count, "sec"
#!/usr/bin/env python                                                           
import numpy
import sys
import timeit

try:
    import numpy.core._dotblas
    print 'FAST BLAS'
except ImportError:
    print 'slow blas'

print "version:", numpy.__version__
print "maxint:", sys.maxint
print

x = numpy.random.random((1000,1000))

setup = "import numpy; x = numpy.random.random((1000,1000))"
count = 5

t = timeit.Timer("numpy.dot(x, x.T)", setup=setup)
print "dot:", t.timeit(count)/count, "sec"

以上是关于python 测试numpy和scipy设置的主要内容,如果未能解决你的问题,请参考以下文章

Windows下python virtualenv使用,镜像源设置,批量安装,安装scipy,numpy

为 numpy、scipy 和 matplotlib 的 intersphinx 链接指定目标

python库安装(numpy+scipy+matplotlib+scikit_learn)

将 python、numpy 和 scipy 代码转换为 C++ 兼容代码?

Python地理数据处理环境的搭建和准备(numpy,scipy,matplotlib)

Windows下Python安装numpy+mkl,Scipy和statsmodels