PZSTEIN(l)

πŸ“¦ version 1.5, in ubuntu jammy

πŸ¦‹ PZSTEIN(l) πŸ¦‹

okay so this is the LAPACK routine PZSTEIN, version 1.5, and she is that girl. sit down, grab a snack, we're doing linear algebra bestie πŸ’…


✨ NAME ✨

PZSTEIN β€” computes the eigenvectors of a symmetric tridiagonal matrix in parallel, using inverse iteration. no cap, that's literally the whole job description 🫢


🌸 SYNOPSIS 🌸

SUBROUTINE PZSTEIN( N, D, E, M, W, IBLOCK, ISPLIT, ORFAC, Z, IZ, JZ,
                    DESCZ, WORK, LWORK, IWORK, LIWORK, IFAIL, ICLUSTR,
                    GAP, INFO )

    INTEGER         INFO, IZ, JZ, LIWORK, LWORK, M, N

    DOUBLE          PRECISION ORFAC

    INTEGER         DESCZ( * ), IBLOCK( * ), ICLUSTR( * ), IFAIL( * ),
                    ISPLIT( * ), IWORK( * )

    DOUBLE          PRECISION D( * ), E( * ), GAP( * ), W( * ), WORK( *
                    )

    COMPLEX*16      Z( * )

like look at all those arguments. main character energy fr fr πŸ‘‘


πŸ’– PURPOSE πŸ’–

PZSTEIN computes the eigenvectors of a symmetric tridiagonal matrix in parallel, using inverse iteration. The eigenvectors found correspond to user specified eigenvalues. And here's the tea, bestie: PZSTEIN does not orthogonalize vectors that are on different processes. The extent of orthogonalization is controlled by the input parameter LWORK. Eigenvectors that are to be orthogonalized are computed by the same process. PZSTEIN decides on the allocation of work among the processes and then calls DSTEIN2 (a modified LAPACK routine) on each individual process. And if insufficient workspace is allocated, the expected orthogonalization may not be done. πŸ™ˆ

πŸ’€ Note : If the eigenvectors obtained are not orthogonal, increase LWORK and run the code again. that's it, that's the fix, just throw more workspace at it and try again.

πŸ“ Notes πŸ“

Each global data object is described by an associated description vector. This vector stores the information required to establish the mapping between an object element and its corresponding process and memory location. iykyk 🧚

Let A be a generic term for any 2D block cyclicly distributed array. Such a global array has an associated description vector DESCA. In the following comments, the character _ should be read as "of the global array". periodt.

So here's the whole notation breakdown, one bullet at a time, because we're being thorough and we don't skip πŸ’…

  • DTYPE_A (global) β€” stored in DESCA( DTYPE_ ) β€” the descriptor type. In this case, DTYPE_A = 1.
  • CTXT_A (global) β€” stored in DESCA( CTXT_ ) β€” the BLACS context handle, indicating the BLACS process grid A is distributed over. The context itself is global, but the handle (the integer value) may vary.
  • M_A (global) β€” stored in DESCA( M_ ) β€” the number of rows in the global array A.
  • N_A (global) β€” stored in DESCA( N_ ) β€” the number of columns in the global array A.
  • MB_A (global) β€” stored in DESCA( MB_ ) β€” the blocking factor used to distribute the rows of the array.
  • NB_A (global) β€” stored in DESCA( NB_ ) β€” the blocking factor used to distribute the columns of the array.
  • RSRC_A (global) β€” stored in DESCA( RSRC_ ) β€” the process row over which the first row of the array A is distributed.
  • CSRC_A (global) β€” stored in DESCA( CSRC_ ) β€” the process column over which the first column of the array A is distributed.
  • LLD_A (local) β€” stored in DESCA( LLD_ ) β€” the leading dimension of the local array. LLD_A >= MAX(1,LOCr(M_A)).

Now let K be the number of rows or columns of a distributed matrix, and assume that its process grid has dimension p x q. 🌈

LOCr( K ) denotes the number of elements of K that a process would receive if K were distributed over the p processes of its process column.

Similarly, LOCc( K ) denotes the number of elements of K that a process would receive if K were distributed over the q processes of its process row. πŸ¦‹

The values of LOCr() and LOCc() may be determined via a call to the ScaLAPACK tool function, NUMROC:

LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).

An upper bound for these quantities may be computed by:

LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A

πŸ’… ARGUMENTS πŸ’…

okay bestie, here's the tea on every single one of these parameters. no skimming, we're reading them all, and yes there are a lot. hydrate first. πŸ“

P = NPROW * NPCOL is the total number of processes. that's it, that's the whole vibe. 🫢


  • N (global input) INTEGER β€” the order of the tridiagonal matrix T. and like, N >= 0, obviously. no negative orders, that's not a thing. ✨
  • D (global input) DOUBLE PRECISION array, dimension (N) β€” the n diagonal elements of the tridiagonal matrix T. the main character diagonal fr. πŸ‘‘
  • E (global input) DOUBLE PRECISION array, dimension (N-1) β€” the (n-1) off-diagonal elements of the tridiagonal matrix T. notice it's N-1 bestie, the off-diagonal is always one shorter, iykyk. πŸ¦‹
  • M (global input) INTEGER β€” the total number of eigenvectors to be found. range is 0 <= M <= N. not greedy, not skimping. πŸ’…
  • W (global input/global output) DOUBLE PRECISION array, dim (M) β€” okay so on input, the first M elements of W hold all the eigenvalues you want eigenvectors for. these need to be grouped by split-off block and ordered smallest to largest within the block β€” the output array W from PDSTEBZ with ORDER='b' is exactly what's expected here. this array should be replicated on all processes, no gatekeeping. on output, the first M elements contain the input eigenvalues in ascending order. ✨
note: to get orthogonal vectors, it's best if the eigenvalues are computed to the highest accuracy β€” you can do this by setting ABSTOL to the underflow threshold = DLAMCH('U'). and yes, ABSTOL is an input parameter to PDSTEBZ, go look it up bestie. πŸ’–
  • IBLOCK (global input) INTEGER array, dimension (N) β€” the submatrix indices that go with the corresponding eigenvalues in W. 1 for eigenvalues in the first submatrix from the top, 2 for the second submatrix, etc. (the output array IBLOCK from PDSTEBZ is expected here). πŸŽ€
  • ISPLIT (global input) INTEGER array, dimension (N) β€” the splitting points, aka where T breaks up into submatrices. first submatrix = rows/columns 1 to ISPLIT(1), second = rows/columns ISPLIT(1)+1 through ISPLIT(2), etc., and the NSPLIT-th = rows/columns ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N. (the output array ISPLIT from PDSTEBZ is expected here, same deal as before.) 🌸
  • ORFAC (global input) DOUBLE PRECISION β€” ORFAC decides which eigenvectors get orthogonalized. eigenvectors whose eigenvalues are within ORFAC*||T|| of each other get the orthogonalization treatment. however β€” and this is important β€” if the workspace isn't enough (peep LWORK), this tolerance may be decreased until all the eigenvectors that need orthogonalizing can fit in one process. if ORFAC equals zero, no orthogonalization happens at all, periodt. and if ORFAC is negative, a default value of 10^-3 gets used. ORFAC should be identical on all processes, no exceptions. 😀
  • Z (local output) COMPLEX*16 array, dimension (DESCZ(DLEN_), N/npcol + NB) β€” Z contains the computed eigenvectors for the specified eigenvalues. any vector that fails to converge gets set to its current iterate after MAXITS iterations (see DSTEIN2). on output, Z is distributed across the P processes in block cyclic format. iconic distribution behavior honestly. 🌈
  • IZ (global input) INTEGER β€” Z's global row index, pointing to the beginning of the submatrix that's about to be operated on. πŸ“
  • JZ (global input) INTEGER β€” Z's global column index, pointing to the beginning of the submatrix that's about to be operated on. πŸ“
  • DESCZ (global and local input) INTEGER array of dimension DLEN_ β€” the array descriptor for the distributed matrix Z. the little ID card for Z, basically. πŸͺͺ
  • WORK (local workspace/global output) DOUBLE PRECISION array, dimension (LWORK) β€” on output, WORK(1) gives a lower bound on the workspace (LWORK) that guarantees the user-desired orthogonalization (check ORFAC). heads up though: this may overestimate the minimum workspace actually needed. πŸ™ˆ
  • LWORK (local input) integer β€” LWORK controls how much orthogonalization can actually get done. the number of eigenvectors that get storage allocated on each process is NVEC = floor(( LWORK- max(5*N,NP00*MQ00) )/N). eigenvectors corresponding to eigenvalue clusters of size NVEC - ceil(M/P) + 1 are guaranteed to be orthogonal (the orthogonality is similar to what you'd get from ZSTEIN2). 🧚
note: LWORK must be no smaller than max(5*N,NP00*MQ00) + ceil(M/P)*N, and should have the same input value on all processes. it's the minimum value of LWORK input across the different processes that's significant. so like, the smallest one wins. πŸ’€

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. so no yelling, it's a vibe check only. ✨

  • IWORK (local workspace/global output) INTEGER array, dimension ( 3*N+P+1 ) β€” on return, IWORK(1) contains the amount of integer workspace required. on return, IWORK(2) through IWORK(P+2) indicate the eigenvectors computed by each process. process I computes eigenvectors indexed IWORK(I+2)+1 thru' IWORK(I+3). yes it says thru', we keep it, that's the vibe. πŸŽ€
  • LIWORK (local input) INTEGER β€” size of array IWORK. must be >= 3*N + P + 1. non-negotiable bestie. πŸ’…

if LIWORK = -1, then LIWORK 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. same energy as above, just the integer twin. 🫢

  • IFAIL (global output) integer array, dimension (M) β€” on a normal exit, all elements of IFAIL are zero. πŸŽ‰ if one or more eigenvectors fail to converge after MAXITS iterations (same as in ZSTEIN), then INFO > 0 gets returned. if mod(INFO,M+1)>0, then for I=1 to mod(INFO,M+1), the eigenvector corresponding to eigenvalue W(IFAIL(I)) failed to converge (W here = the array of eigenvalues on output). 😭
  • ICLUSTR (global output) integer array, dimension (2*P) β€” this output array holds the indices of eigenvectors corresponding to a cluster of eigenvalues that couldn't be orthogonalized because the workspace wasn't enough (peep LWORK, ORFAC and INFO). eigenvectors for clusters indexed ICLUSTR(2*I-1) to ICLUSTR(2*I), I = 1 to INFO/(M+1), couldn't be orthogonalized due to lack of workspace. so those eigenvectors corresponding to those clusters may not be orthogonal, periodt. ICLUSTR is a zero-terminated array β€” ( ICLUSTR(2*K).NE.0 .AND. ICLUSTR(2*K+1).EQ.0 ) if and only if K is the number of clusters. 🧠
  • GAP (global output) DOUBLE PRECISION array, dimension (P) β€” this output array holds the gap between eigenvalues whose eigenvectors couldn't be orthogonalized. the INFO/M output values in this array correspond to the INFO/(M+1) clusters indicated by ICLUSTR. as a result, the dot product between eigenvectors for the I^th cluster may be as high as ( O(n)*macheps ) / GAP(I). lowkey a warning, highkey just facts. 🌸
  • INFO (global output) INTEGER β€” the receipts:
    • = 0: successful exit. we ate. πŸŽ‰
    • < 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. also: < 0 : if INFO = -I, the I-th argument had an illegal value. πŸ’€
    • > 0: if mod(INFO,M+1) = I, then I eigenvectors failed to converge in MAXITS iterations, and their indices are stored in the array IFAIL. if INFO/(M+1) = I, then eigenvectors corresponding to I clusters of eigenvalues could not be orthogonalized due to insufficient workspace, and the indices of the clusters are stored in the array ICLUSTR. 😭

and that's the whole page bestie!! you made it, I'm so proud of you fr fr. πŸ₯ΉπŸ’–

this one's from LAPACK version 1.5, dated 12 May 1997, and it's PZSTEIN(l) β€” go forth and orthogonalize (or don't, if ORFAC is zero, lmao). bye bestie, love u, slay πŸ’…βœ¨

πŸ“¦ where this page comes from