[SciPy-dev] ARPACK wrapper

Nils Wagner nwagner at iam.uni-stuttgart.de
Mon Nov 20 08:57:37 CST 2006


Nils Wagner wrote:
> Aric Hagberg wrote:
>   
>> On Mon, Nov 20, 2006 at 09:45:47AM +0100, Nils Wagner wrote:
>>   
>>     
>>> Hi Neilen,
>>>
>>> In order to compare the results with the workhorse eig I have used a
>>> very small
>>> order n. The number of desired eigenpairs is equal to k=4 in my example,
>>> but the
>>> shape of the array of eigenvectors is (n,k+1) and for the eigenvalues it
>>> is (k+1,).
>>> The eigenvectors returned by arpack.eigen are zero.
>>>
>>> Nils
>>>     
>>>       
>> Hi Nils,
>>
>> The size of the return arrays are intentional (k+1).  This is 
>> the way ARPACK returns eigenvalues and eigenvectors for nonsymmetric
>> matrices.  I think the idea is that the k'th eigenvalue
>> (largest, smallest, etc) might be a complex conjugate pair and
>> then you might want k+1 (the conjugate).  Else, if the k'th
>> eigenvalue is real that entry is zero.   
>>
>> I can run your test example successfully.  Do the tests in
>> arpack/tests/test_arpack.py work for you?  
>>
>> Aric
>>
>>  
>>
>> _______________________________________________
>> Scipy-dev mailing list
>> Scipy-dev at scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-dev
>>   
>>     
> help (arpack.eigen) yields
> eigen(A, k=6, M=None, ncv=None, which='LM', maxiter=None, tol=0,
> return_eigenvectors=True)
>     Return k eigenvalues and eigenvectors of the matrix A.
>
>     Solves A * x[i] = w[i] * x[i], the standard eigenvalue problem for
>     w[i] eigenvalues with corresponding eigenvectors x[i].
>
>     Inputs:
>
>     A --  A matrix, array or an object with matvec(x) method to perform
>           the matrix vector product A * x.  The sparse matrix formats
>           in scipy.sparse are appropriate for A.
>
>     k -- The number of eigenvalue/eigenvectors desired
>
>     M -- (Not implemented)
>           A symmetric positive-definite matrix for the generalized
>           eigenvalue problem A * x = w * M * x
>
>     Outputs:
>
>     w -- An array of k eigenvalues
>
>     v -- An array of k eigenvectors, k[i] is the eigenvector corresponding
>          to the eigenvector w[i]
>
> This info doesn't match with your explanation.
>
> Concerning the tests I get
>
> /usr/bin/python
> /usr/lib64/python2.4/site-packages/scipy/sandbox/arpack/tests/test_speigs.py
>   Found 1 tests for __main__
>
>  _naupd: Number of update iterations taken
>  -----------------------------------------
>     1 -    1:    17
>
>
>  _naupd: Number of wanted "converged" Ritz values
>  ------------------------------------------------
>     1 -    1:     4
>
>
>  _naupd: Real part of the final Ritz values
>  ------------------------------------------
>     1 -    4:   1.033E+00   7.746E-01   5.164E-01   2.582E-01
>
>
>  _naupd: Imaginary part of the final Ritz values
>  -----------------------------------------------
>     1 -    4:   0.000E+00   0.000E+00   0.000E+00   0.000E+00
>
>
>  _naupd: Associated Ritz estimates
>  ---------------------------------
>     1 -    4:   4.508E-17   7.450E-22   7.087E-26   4.834E-29
>
>
>
>      =============================================
>      = Nonsymmetric implicit Arnoldi update code =
>      = Version Number:  2.4                      =
>      = Version Date:    07/31/96                 =
>      =============================================
>      = Summary of timing statistics              =
>      =============================================
>
>
>      Total number update iterations             =    17
>      Total number of OP*x operations            =    59
>      Total number of B*x operations             =     0
>      Total number of reorthogonalization steps  =    58
>      Total number of iterative refinement steps =     0
>      Total number of restart steps              =     0
>      Total time in user OP*x operation          =     0.004000
>      Total time in user B*x operation           =     0.000000
>      Total time in Arnoldi update routine       =     0.008000
>      Total time in naup2 routine                =     0.008000
>      Total time in basic Arnoldi iteration loop =     0.004000
>      Total time in reorthogonalization phase    =     0.000000
>      Total time in (re)start vector generation  =     0.000000
>      Total time in Hessenberg eig. subproblem   =     0.000000
>      Total time in getting the shifts           =     0.000000
>      Total time in applying the shifts          =     0.000000
>      Total time in convergence testing          =     0.000000
>      Total time in computing final Ritz vectors =     0.000000
>
> .
> ----------------------------------------------------------------------
> Ran 1 test in 0.107s
>
> OK
>
>
> /usr/bin/python
> /usr/lib64/python2.4/site-packages/scipy/sandbox/arpack/tests/test_arpack.py
>   Found 5 tests for __main__
> .....
> ----------------------------------------------------------------------
> Ran 5 tests in 0.039s
>
> OK
>  
> Nils
>
>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>   
Hi Aric,

Please can you run the following
 
I get something like

 _naupd: Number of update iterations taken
 -----------------------------------------
    1 -    1:    61


 _naupd: Number of wanted "converged" Ritz values
 ------------------------------------------------
    1 -    1:     0


 _naupd: Real part of the final Ritz values
 ------------------------------------------

 _naupd: Imaginary part of the final Ritz values
 -----------------------------------------------

 _naupd: Associated Ritz estimates
 ---------------------------------


     =============================================
     = Nonsymmetric implicit Arnoldi update code =
     = Version Number:  2.4                      =
     = Version Date:    07/31/96                 =
     =============================================
     = Summary of timing statistics              =
     =============================================


     Total number update iterations             =    61
     Total number of OP*x operations            =   225
     Total number of B*x operations             =     0
     Total number of reorthogonalization steps  =   118
     Total number of iterative refinement steps =     0
     Total number of restart steps              =     0
     Total time in user OP*x operation          =     0.008002
     Total time in user B*x operation           =     0.000000
     Total time in Arnoldi update routine       =     0.020002
     Total time in naup2 routine                =     0.020002
     Total time in basic Arnoldi iteration loop =     0.008002
     Total time in reorthogonalization phase    =     0.000000
     Total time in (re)start vector generation  =     0.000000
     Total time in Hessenberg eig. subproblem   =     0.008000
     Total time in getting the shifts           =     0.000000
     Total time in applying the shifts          =     0.004000
     Total time in convergence testing          =     0.000000
     Total time in computing final Ritz vectors =     0.000000

Traceback (most recent call last):
  File "eigs1.py", line 11, in ?
    w1,v1 = arpack.speigs.eigvals(matvec,a.shape[0],nev=nev,ncv=ncv)
  File
"/usr/lib64/python2.4/site-packages/scipy/sandbox/arpack/speigs.py",
line 71, in eigvals
    if info != 0: raise "Hell" # Indicates some error during the
Arnouldi iterations
Hell


-------------- next part --------------
A non-text attachment was scrubbed...
Name: eigs1.py
Type: text/x-python
Size: 193 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20061120/ae066a81/attachment.py 


More information about the Scipy-dev mailing list