numpy.dot是否等于BLAS gemm / gemv?

时间:2015-12-26 00:48:09

标签: python numpy blas

看起来numpy.dot不等于blas的gemv / gemm,这是实验:

>>> import numpy
>>> numpy.show_config()
lapack_opt_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/anaconda/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_opt_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/anaconda/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/anaconda/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
openblas_lapack_info:
    libraries = ['openblas']
    library_dirs = ['/usr/local/anaconda/lib']
    define_macros = [('HAVE_CBLAS', None)]
    language = c
blas_mkl_info:
  NOT AVAILABLE
>>> A=numpy.random.randn(100,50)
>>> x=numpy.random.randn(50)
>>> from scipy import linalg
>>> gemv = linalg.get_blas_funcs("gemv")
>>> numpy.all(gemv(1,A,x)==numpy.dot(A,x))
False
>>> gemm = linalg.get_blas_funcs("gemm")
>>> numpy.all(gemm(1,A,x)==numpy.dot(A,x))
False

我不知道为什么,任何人都可以告诉我如何构建一个基于BLAS的函数等于numpy.dot

0 个答案:

没有答案