[SciPy-user] Sparse eigenvalues/eigenvectors problem

Nils Wagner nwagner at iam.uni-stuttgart.de
Thu Jun 12 14:03:43 EDT 2008


On Thu, 12 Jun 2008 15:24:52 +0100
  "James Philbin" <philbinj at gmail.com> wrote:
> Hi,
> 
> I'm trying to find the first few (~50) eigenvectors of a 
>largish
> (2130x2130) sparse symmetric real matrix. I've used
> scipy.sparse.linalg.eigen_symmetric but have hit upon a 
>few niggles.
> If I ask for 10 eigenvectors, with the following command
> eigen_symmetric(S,k=10,which='LA'), I get the following 
>eigenvalues:
> [ 0.99729875  0.99770773  0.9987255   0.99883746  1. 
>         1.
>   1.        1.          1.          1.        ]
> 
> Running with k=20 gives:
> [ 0.99470154  0.99567495  0.99619173  0.99729875 
> 0.99770773  0.9987255
>  0.99883746  1.          1.          1.          1. 
>         1.          1.
>  1.          1.          1.          1.          1. 
>         1.
>   1.        ]
> 
> So it seems that eigen_symmetric is failing to find lots 
>of the
> repeated 1 eigenvectors. Is this an inherent problem 
>with ARPACK or
> symptomatic of a bug in scipy? Matlab's eigs seems to 
>not suffer from
> this nearly as much, returning nearly all ones for both 
>the 10 and 20
> cases. I assume this is also using ARPACK under the 
>surface. I can
> upload the matrix S somewhere if people are interested.
> 
> I also think i've fixed a bug in the current version of 
>arpack.py
> relating to the info returned (The warning that maxiters 
>had been
> reached was never shown) and added a warning if some 
>eigenvectors
> didn't converge:
> 
> --- arpack.py.old	2008-06-12 13:28:29.000000000 +0100
> +++ arpack.py	2008-06-12 15:22:55.000000000 +0100
> @@ -463,8 +463,11 @@
>     if  info < -1 :
>         raise RuntimeError("Error info=%d in 
>arpack"%info)
>         return None
> -    if info == -1:
> +    if info == 1:
>         warnings.warn("Maximum number of iterations 
>taken: %s"%iparam[2])
> +
> +    if iparam[4]<k:
> +      warnings.warn("Only %d/%d eigenvectors converged" 
>% (iparam[4], k))
> 
>     # now extract eigenvalues and (optionally) 
>eigenvectors
>     rvec = return_eigenvectors
> 
> 
> Thanks,
> James

Hi James,

Please can you send me the matrix off-list (*.mtx).
  

Thanks in advance,
                      Nils



More information about the SciPy-User mailing list