[SciPy-dev] Matlab function eigs(A,B) in scipy

Nils Wagner nwagner at mecha.uni-stuttgart.de
Mon Jun 16 10:06:21 CDT 2003

Hi all,

I wonder if the matlab function eigs will be available in scipy in the
near future.

Any suggestion ?


>>help eigs

 EIGS  Find a few eigenvalues and eigenvectors of a matrix using ARPACK.
    D = EIGS(A) returns a vector of A's 6 largest magnitude eigenvalues.
    A must be square and should be large and sparse.
    [V,D] = EIGS(A) returns a diagonal matrix D of A's 6 largest
    eigenvalues and a matrix V whose columns are the corresponding
    [V,D,FLAG] = EIGS(A) also returns a convergence flag.  If FLAG is 0
    then all the eigenvalues converged; otherwise not all converged.
    EIGS(A,B) solves the generalized eigenvalue problem A*V == B*V*D.  B
    be symmetric (or Hermitian) positive definite and the same size as
    EIGS(A,[],...) indicates the standard eigenvalue problem A*V == V*D.
    EIGS(A,K) and EIGS(A,B,K) return the K largest magnitude
    EIGS(A,K,SIGMA) and EIGS(A,B,K,SIGMA) return K eigenvalues based on
       'LM' or 'SM' - Largest or Smallest Magnitude
    For real symmetric problems, SIGMA may also be:
       'LA' or 'SA' - Largest or Smallest Algebraic
       'BE' - Both Ends, one more from high end if K is odd
    For nonsymmetric and complex problems, SIGMA may also be:
       'LR' or 'SR' - Largest or Smallest Real part
       'LI' or 'SI' - Largest or Smallest Imaginary part
    If SIGMA is a real or complex scalar including 0, EIGS finds the
    closest to SIGMA.  For scalar SIGMA, and also when SIGMA = 'SM'
which uses
    the same algorithm as SIGMA = 0, B need only be symmetric (or
    positive semi-definite since it is not Cholesky factored as in the
other cases.
    EIGS(A,K,SIGMA,OPTS) and EIGS(A,B,K,SIGMA,OPTS) specify options:
    OPTS.issym: symmetry of A or A-SIGMA*B represented by AFUN [{0} | 1]
    OPTS.isreal: complexity of A or A-SIGMA*B represented by AFUN [0 |
    OPTS.tol: convergence: Ritz estimate residual <= tol*NORM(A) [scalar
| {eps}]
    OPTS.maxit: maximum number of iterations [integer | {300}]
    OPTS.p: number of Lanczos vectors: K+1<p<=N [integer | {2K}]
    OPTS.v0: starting vector [N-by-1 vector | {randomly generated by
    OPTS.disp: diagnostic information display level [0 | {1} | 2]
    OPTS.cholB: B is actually its Cholesky factor CHOL(B) [{0} | 1]
    OPTS.permB: sparse B is actually CHOL(B(permB,permB)) [permB |
    EIGS(AFUN,N) accepts the function AFUN instead of the matrix A.
    Y = AFUN(X) should return
       A*X            if SIGMA is not specified, or is a string other
than 'SM'
       A\X            if SIGMA is 0 or 'SM'
       (A-SIGMA*I)\X  if SIGMA is a nonzero scalar (standard eigenvalue
       (A-SIGMA*B)\X  if SIGMA is a nonzero scalar (generalized
eigenvalue problem)
    N is the size of A. The matrix A, A-SIGMA*I or A-SIGMA*B represented
by AFUN is
    assumed to be real and nonsymmetric unless specified otherwise by
    and OPTS.issym. In all these EIGS syntaxes, EIGS(A,...) may be
replaced by
    EIGS(AFUN,N,K,SIGMA,OPTS,P1,P2,...) and
    provide for additional arguments which are passed to
       A = delsq(numgrid('C',15));  d1 = eigs(A,5,'SM');
    Equivalently, if dnRk is the following one-line function:
       function y = dnRk(x,R,k)
       y = (delsq(numgrid(R,k))) \ x;
    then pass dnRk's additional arguments, 'C' and 15, to EIGS:
       n = size(A,1);  opts.issym = 1;  d2 =
    See also EIG, SVDS, ARPACKC.


More information about the Scipy-dev mailing list