[SciPy-User] linalg.eigh hangs only after importing sparse module

Nils Wagner nwagner@iam.uni-stuttgart...
Mon Mar 19 14:15:52 CDT 2012


On Mon, 19 Mar 2012 19:24:33 +0100
  Nicolas Pinto <nicolas.pinto@gmail.com> wrote:
> Hello,
> 
> The following simple code hangs only when sparse has 
>been imported:
> 
> ```
> from scipy import sparse  # <<<<<<< BUG
> import numpy as np
> from scipy import linalg
> 
> N = 1000
> np.random.seed(42)
> X = np.random.random((N, N))
> print X.mean()
> v, Q = linalg.eigh(X)
> print v.mean()
> ```
> 
> Do you think this may be related to other 
>arpack/umfpack/etc. known failures ?
> 
> Please let us know how can we help fix this issue.
> 
> Thanks for your help.
> 
> Regards,
> 

Your matrix X  is not symmetric.
>>> X-X.T
array([[ 0.        ,  0.76558138,  0.47028826, ..., 
 0.0515565 ,
          0.19001774,  0.33171462],
        [-0.76558138,  0.        ,  0.62596704, ..., 
-0.0230795 ,
         -0.90677174,  0.12238354],
        [-0.47028826, -0.62596704,  0.        , ..., 
-0.38459427,
          0.28527075,  0.04568694],
        ...,
        [-0.0515565 ,  0.0230795 ,  0.38459427, ...,  0. 
       ,
          0.57859577, -0.24268277],
        [-0.19001774,  0.90677174, -0.28527075, ..., 
-0.57859577,
          0.        ,  0.52747713],
        [-0.33171462, -0.12238354, -0.04568694, ..., 
 0.24268277,
         -0.52747713,  0.        ]])

eigh assumes a symmetric or hermitian matrix.

Nils


More information about the SciPy-User mailing list