Last active
December 29, 2015 19:18
-
-
Save ihaque/882dc3fbc1731f88abb2 to your computer and use it in GitHub Desktop.
Broken numpy.eigh
This file contains hidden or 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
Eigenvalues OK for matrix of size 559? (Remove head) True | |
Eigenvalues OK for matrix of size 559? (Remove tail) True | |
Eigenvalues OK for matrix of size 560? False | |
Numpy configuration | |
version: 1.10.2 | |
lapack_opt_info: | |
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate'] | |
extra_compile_args = ['-msse3'] | |
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)] | |
openblas_lapack_info: | |
NOT AVAILABLE | |
atlas_3_10_blas_threads_info: | |
NOT AVAILABLE | |
atlas_threads_info: | |
NOT AVAILABLE | |
atlas_3_10_threads_info: | |
NOT AVAILABLE | |
atlas_blas_info: | |
NOT AVAILABLE | |
atlas_3_10_blas_info: | |
NOT AVAILABLE | |
atlas_blas_threads_info: | |
NOT AVAILABLE | |
openblas_info: | |
NOT AVAILABLE | |
blas_mkl_info: | |
NOT AVAILABLE | |
blas_opt_info: | |
extra_link_args = ['-Wl,-framework', '-Wl,Accelerate'] | |
extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers'] | |
define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)] | |
atlas_info: | |
NOT AVAILABLE | |
atlas_3_10_info: | |
NOT AVAILABLE | |
lapack_mkl_info: | |
NOT AVAILABLE | |
mkl_info: | |
NOT AVAILABLE |
This file contains hidden or 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
$ ~/anaconda2/bin/python testcase.py | |
Vendor: Continuum Analytics, Inc. | |
Package: mkl | |
Message: trial mode expires in 30 days | |
Eigenvalues OK for matrix of size 559? (Remove head) True | |
Eigenvalues OK for matrix of size 559? (Remove tail) True | |
Eigenvalues OK for matrix of size 560? True | |
Numpy configuration | |
version: 1.10.2 | |
lapack_opt_info: | |
libraries = ['mkl_lapack95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5', 'pthread'] | |
library_dirs = ['/Users/ihaque/anaconda2/lib'] | |
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] | |
include_dirs = ['/Users/ihaque/anaconda2/include'] | |
blas_opt_info: | |
libraries = ['mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5', 'pthread'] | |
library_dirs = ['/Users/ihaque/anaconda2/lib'] | |
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] | |
include_dirs = ['/Users/ihaque/anaconda2/include'] | |
openblas_lapack_info: | |
NOT AVAILABLE | |
lapack_mkl_info: | |
libraries = ['mkl_lapack95_lp64', 'mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5', 'pthread'] | |
library_dirs = ['/Users/ihaque/anaconda2/lib'] | |
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] | |
include_dirs = ['/Users/ihaque/anaconda2/include'] | |
blas_mkl_info: | |
libraries = ['mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5', 'pthread'] | |
library_dirs = ['/Users/ihaque/anaconda2/lib'] | |
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] | |
include_dirs = ['/Users/ihaque/anaconda2/include'] | |
mkl_info: | |
libraries = ['mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5', 'pthread'] | |
library_dirs = ['/Users/ihaque/anaconda2/lib'] | |
define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)] | |
include_dirs = ['/Users/ihaque/anaconda2/include'] |
This file contains hidden or 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 | |
def compare(mat): | |
def eigvals(mat, fn): | |
w, v = fn(mat) | |
inds = np.argsort(w) | |
w = w[inds] | |
return w | |
w = eigvals(mat, np.linalg.eig) | |
wh = eigvals(mat, np.linalg.eigh) | |
return np.allclose(w, wh) | |
rmat = np.asmatrix(np.random.rand(560, 560)) | |
rmat = rmat * rmat.T # Ensure symmetric | |
print "Eigenvalues OK for matrix of size 559? (Remove head)", compare(rmat[1:, 1:]) | |
print "Eigenvalues OK for matrix of size 559? (Remove tail)", compare(rmat[:-1, :-1]) | |
print "Eigenvalues OK for matrix of size 560?", compare(rmat) | |
print "Numpy configuration" | |
print "version:", np.__version__ | |
np.__config__.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment