Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Yue__Zhengyuan
Beginner
112 Views

Bug in GESVD ?

I installed Anaconda 2019.03 release on macOS Mojave 10.14.4, and I tried doing SVD of a very simple matrix:

import numpy as np
import scipy.linalg as LA

mat = np.array([[-1,0], [0,-1-1j]], dtype=complex)
s = LA.svd(mat, full_matrices=False, lapack_driver='gesvd')
print(s)

However, the output is wrong

[1.    1.    ]  # should be [1.41421356 1.        ]

The correct result can be obtained by setting either "compute_uv=False" or " lapack_driver='gesdd' "

Anaconda is now using the SciPy packages with MKL optimization by default. If I remove the default SciPy packages and installed the version that uses OpenBLAS, the problem will gone. The problem seems to be CPU dependent. I want to know if any other people can reproduce this problem.

 

My system information:

OS: macOS 10.14.4 (18E226)
CPU: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz

numpy.__config__.show() result:

mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
blas_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
blas_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
lapack_mkl_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']
lapack_opt_info:
    libraries = ['mkl_rt', 'pthread']
    library_dirs = ['/Users/zhengyuanyue/anaconda3/lib']
    define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
    include_dirs = ['/Users/zhengyuanyue/anaconda3/include']

 

0 Kudos
1 Reply
112 Views

Hi, 

Thank you for taking the time to bring this issue to our attention.
I was able to reproduce the erroneous behavior, and will pass the report on to the MKL team.
MKL on Linux is producing the expected result. 

Sorry about the inconvenience. 

Sincerely,
Oleksandr

Reply