# p?syev

Computes selected eigenvalues and eigenvectors of a symmetric matrix.

## Syntax

call pssyev( jobz, uplo, n, a, ia, ja, desca, w, z, iz, jz, descz, work, lwork, info )

call pdsyev( jobz, uplo, n, a, ia, ja, desca, w, z, iz, jz, descz, work, lwork, info )

## Description

This routine computes all eigenvalues and, optionally, eigenvectors of a real symmetric matrix A by calling the recommended sequence of ScaLAPACK routines.

In its present form, the routine assumes a homogeneous system and makes no checks for consistency of the eigenvalues or eigenvectors across the different processes. Because of this, it is possible that a heterogeneous system may return incorrect results without any error messages.

## Input Parameters

np = the number of rows local to a given process.

nq = the number of columns local to a given process.

jobz

  (global). CHARACTER. Must be 'N' or 'V'. Specifies if it is necessary to compute the eigenvectors:

  If `jobz ='N'`, then only eigenvalues are computed.

  If `jobz ='V'`, then eigenvalues and eigenvectors are computed.

uplo

  (global). CHARACTER. Must be 'U' or 'L'. Specifies whether the upper or lower triangular part of the symmetric matrix A is stored:

  If `uplo = 'U'`, a stores the upper triangular part of A.

  If `uplo = 'L'`, a stores the lower triangular part of A.

n

  (global) INTEGER. The number of rows and columns of the matrix A `(n ≥ 0)`.

a

  (local)

  REAL for pssyev.

  DOUBLE PRECISION for pdsyev.

  Block cyclic array of global dimension (n, n) and local dimension `(lld_a, LOC c(ja+n-1))`. On entry, the symmetric matrix A.

  If `uplo = 'U'`, only the upper triangular part of A is used to define the elements of the symmetric matrix.

  If `uplo = 'L'`, only the lower triangular part of A is used to define the elements of the symmetric matrix.

ia, ja

  (global) INTEGER. The row and column indices in the global array a indicating the first row and the first column of the submatrix A, respectively.

desca

  (global and local) INTEGER array, dimension (dlen_). The array descriptor for the distributed matrix A.

iz, jz

  (global) INTEGER. The row and column indices in the global array z indicating the first row and the first column of the submatrix Z, respectively.

descz

  (global and local) INTEGER array, dimension (dlen_). The array descriptor for the distributed matrix Z.

work

  (local)

  REAL for pssyev.

  DOUBLE PRECISION for pdsyev.

  Array, DIMENSION (lwork).

lwork

  (local) INTEGER. See below for definitions of variables used to define lwork.

  If no eigenvectors are requested (`jobz = 'N'`), then `lwork ≥ 5*n + sizesytrd + 1`,

  where `sizesytrd` is the workspace for p?sytrd and is `max(NB*(np +1), 3*NB)`.

  If eigenvectors are requested (`jobz = 'V'`) then the amount of workspace required to guarantee that all eigenvectors are computed is:

  `qrmem = 2*n-2`

  `lwmin = 5*n + n*ldc + max(sizemqrleft, qrmem) + 1`

  Variable definitions:

  `nb = desca(mb_) = desca(nb_) = descz(mb_) = descz``(nb_);`

  `nn = max(n, nb, 2);`

  `desca(rsrc_) = desca(rsrc_) = descz(rsrc_) = descz(csrc_) = 0`

  `np = numroc(nn, nb, 0, 0, NPROW)`

  `nq = numroc(max(n, nb, 2), nb, 0, 0, NPCOL)`

  `nrc = numroc(n, nb, myprowc, 0, NPROCS)`

  `ldc = max(1, nrc)`

  `sizemqrleft` is the workspace for p?ormtr when its side argument is 'L'.

  myprowc is defined when a new context is created as follows:

  `call blacs_get(desca(ctxt_), 0, contextc)`

  `call` `blacs_gridinit(contextc, 'R', NPROCS, 1)`

  `call` `blacs_gridinfo(contextc, nprowc, npcolc, myprowc, mypcolc)`

  If `lwork = -1`, then lwork is global input and a workspace query is assumed; the routine only calculates the minimum and optimal size for all work arrays. Each of these values is returned in the first entry of the corresponding work array, and no error message is issued by pxerbla.

## Output Parameters

a

  On exit, the lower triangle (if `uplo='L'`) or the upper triangle (if `uplo='U'`) of A, including the diagonal, is destroyed.

w

  (global). REAL for pssyev

  DOUBLE PRECISION for pdsyev

  Array, DIMENSION (n).

  On normal exit, the first m entries contain the selected eigenvalues in ascending order.

z

  (local). REAL for pssyev

  DOUBLE PRECISION for pdsyev

  Array, global dimension (n, n), local dimension `(lld_z, LOCc(jz+n-1))`. If `jobz = 'V'`, then on normal exit the first m columns of z contain the orthonormal eigenvectors of the matrix corresponding to the selected eigenvalues.

  If `jobz = 'N'`, then z is not referenced.

work(1)

  On output, `work(1)` returns the workspace needed to guarantee completion. If the input parameters are incorrect, `work(1)` may also be incorrect.

  If `jobz = 'N' `work(1)` =` minimal (optimal) amount of workspace

  If `jobz = 'V' `work(1)` =` minimal workspace required to generate all the eigenvectors.

info

  (global) INTEGER.

  If `info = 0`, the execution is successful.

  If `info < 0`: If the i-th argument is an array and the j-entry had an illegal value, then `info = -(i*100+j)`, if the i-th argument is a scalar and had an illegal value, then `info = -i`.

  If `info > 0`:

  If `info= 1` through n, the i-th eigenvalue did not converge in ?steqr2 after a total of 30n iterations.

  If `info= n+1`, then p?syev has detected heterogeneity by finding that eigenvalues were not identical across the process grid. In this case, the accuracy of the results from p?syev cannot be guaranteed.

Parent topic: Driver Routines