PDLAHQR(l)
π PDLAHQR(l) β LAPACK auxiliary routine (version 1.5) π
okay bestie, welcome to PDLAHQR(l) β a LAPACK auxiliary routine, version 1.5. This is part 1, and it's giving Hessenberg energy π
.
β¨ NAME β¨
PDLAHQR β an auxiliary routine used to find the Schur decomposition and or eigenvalues of a matrix already in Hessenberg form from cols ILO to IHI. π¦
β¨ SYNOPSIS β¨
Here's the whole signature, no cap:
SUBROUTINE PDLAHQR( WANTT, WANTZ, N, ILO, IHI, A, DESCA, WR, WI, ILOZ,
IHIZ, Z, DESCZ, WORK, LWORK, IWORK, ILWORK, INFO )
LOGICAL WANTT, WANTZ
INTEGER IHI, IHIZ, ILO, ILOZ, ILWORK, INFO, LWORK, N, ROTN
INTEGER DESCA( * ), DESCZ( * ), IWORK( * )
DOUBLE PRECISION A( * ), WI( * ), WORK( * ), WR( * ), Z( *
)
β¨ PURPOSE β¨
PDLAHQR is an auxiliary routine used to find the Schur decomposition and or eigenvalues of a matrix already in Hessenberg form from cols ILO to IHI. That's the whole vibe. π
π§ 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.
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".
π NOTATION / STORED IN / EXPLANATION π
DTYPE_A(global)β stored inDESCA( DTYPE_ )β The descriptor type. In this case,DTYPE_A = 1.CTXT_A(global) β stored inDESCA( 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 inDESCA( M_ )β The number of rows in the global arrayA.N_A(global) β stored inDESCA( N_ )β The number of columns in the global arrayA.MB_A(global) β stored inDESCA( MB_ )β The blocking factor used to distribute the rows of the array.NB_A(global) β stored inDESCA( NB_ )β The blocking factor used to distribute the columns of the array.RSRC_A(global) β stored inDESCA( RSRC_ )β The process row over which the first row of the arrayAis distributed.CSRC_A(global) β stored inDESCA( CSRC_ )β The process column over which the first column of the arrayAis distributed.LLD_A(local) β stored inDESCA( LLD_ )β The leading dimension of the local array.LLD_A >= MAX(1,LOCr(M_A)).
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 β¨
WANTT(global input)LOGICALβ set it to.TRUE.and you're asking for the full Schur form T π. Set it to.FALSE.and bestie, we're only here for the eigenvalues, nothing more.WANTZ(global input)LOGICALβ.TRUE.means you want the matrix of Schur vectors Z π¦..FALSE.means no Schur vectors for you, sorry bestie.N(global input)INTEGERβ the order of the Hessenberg matrix A (and of Z too, ifWANTZis on). Constraint:N >= 0. no cap πILO(global input)INTEGERandIHI(global input)INTEGERβ so here's the deal: it's assumed that A is already upper quasi-triangular in rows and columnsIHI+1:N, and thatA(ILO,ILO-1) = 0(unlessILO = 1, obviously π ).PDLAHQRworks primarily with the Hessenberg submatrix in rows and columns ILO to IHI, but it applies transformations to all of H ifWANTTis.TRUE.. Constraints:1 <= ILO <= max(1,IHI)andIHI <= N.A(global input/output)DOUBLE PRECISIONarray, dimension(DESCA(LLD_),*)β on entry, this is your upper Hessenberg matrix A π. On exit, ifWANTTis.TRUE.,Ais upper quasi-triangular in rows and columnsILO:IHI, with any 2-by-2 (or bigger!) diagonal blocks not yet in standard form (yeah, we know, it's giving chaos π« ). IfWANTTis.FALSE., the contents ofAare unspecified on exit β like, genuinely unspecified, don't come for us.DESCA(global and local input)INTEGERarray of dimensionDLEN_β the array descriptor for the distributed matrixAπ.WR(global replicated output)DOUBLE PRECISIONarray, dimension(N)andWI(global replicated output)DOUBLE PRECISIONarray, dimension(N)β these two hold the real and imaginary parts of the computed eigenvaluesILOtoIHI, stored in the corresponding elements ofWRandWI. If two eigenvalues come out as a complex conjugate pair, they get stored in consecutive elements ofWRandWI, say the i-th and (i+1)th, withWI(i) > 0andWI(i+1) < 0. And ifWANTTis.TRUE., the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in A. Heads up though:Amay be returned with larger diagonal blocks until the next release π.ILOZ(global input)INTEGERandIHIZ(global input)INTEGERβ these specify the rows of Z that transformations must be applied to, but only ifWANTZis.TRUE.. Constraints:1 <= ILOZ <= ILOandIHI <= IHIZ <= Nβ¨.Z(global input/output)DOUBLE PRECISIONarray β ifWANTZis.TRUE., then on entryZmust contain the current matrix Z of transformations accumulated by PDHSEQR, and on exitZhas been updated; transformations get applied only to the submatrixZ(ILOZ:IHIZ,ILO:IHI). IfWANTZis.FALSE.,Zis not referenced at all, like it doesn't even exist π.DESCZ(global and local input)INTEGERarray of dimensionDLEN_β the array descriptor for the distributed matrixZπΈ.WORK(local output)DOUBLE PRECISIONarray of sizeLWORKβ (unlessLWORK=-1, in which caseWORKmust be at least size 1).LWORK(local input)INTEGERβWORK(LWORK)is a local array, andLWORKis assumed big enough so that:
LWORK >= 3*N + MAX( 2*MAX(DESCZ(LLD_),DESCA(LLD_)) + 2*LOCc(N),
7*Ceil(N/HBL)/LCM(NPROW,NPCOL)) + MAX( 2*N,
(8*LCM(NPROW,NPCOL)+2)**2 )
If LWORK=-1, then WORK(1) gets set to the above number and the code returns immediately πββοΈ.
IWORK(global and local input)INTEGERarray of sizeILWORKβ this will hold some of theIBLKinteger arrays. It's held as a place holder for a future release. Currently unreferenced π.ILWORK(local input)INTEGERβ this will hold the size of theIWORKarray. Also a place holder for a future release. Also currently unreferenced π.INFO(global output)INTEGERβ the vibe check on how everything went:< 0: parameter number-INFOis incorrect or inconsistent β= 0: successful exit π> 0:PDLAHQRfailed to compute all the eigenvalues ILO to IHI in a total of30*(IHI-ILO+1)iterations; ifINFO = i, elementsi+1:ihiofWRandWIcontain those eigenvalues which have been successfully computed (partial slay, honestly).
π§ Logic π§
This algorithm is very similar to _LAHQR. But unlike _LAHQR, instead of sending one double shift through the largest unreduced submatrix, this algorithm sends multiple double shifts and spaces them apart so that there can be parallelism across several processor row/columns π₯. Another critical difference: this algorithm aggregates multiple transforms together in order to apply them in a block fashion. it's giving efficiency, periodt.
π Important Local Variables π
IBLK= the maximum number of bulges that can be computed. Currently fixed. In future releases this won't be fixed.HBL= the square block size (HBL=DESCA(MB_)=DESCA(NB_)).ROTN= the number of transforms to block together.NBULGE= the number of bulges that will be attempted on the current submatrix.IBULGE= the current number of bulges started.K1(*),K2(*)= the current bulge loops fromK1(*)toK2(*).
π Subroutines π
From LAPACK, this routine calls:
DLAHQR-> Serial QR used to determine shifts and eigenvalues.DLARFG-> Determine the Householder transforms.
From ScaLAPACK, this routine calls:
PDLACONSB-> To determine where to start each iteration.DLAMSH-> Sends multiple shifts through a small submatrix to see how the consecutive subdiagonals change (ifPDLACONSBindicates we can start a run in the middle).PDLAWIL-> Given the shift, get the transformation.DLASORTE-> Pair up eigenvalues so that reals are paired.PDLACP3-> Parallel array to local replicated array copy & back.DLAREF-> Row/column reflector applier. Core routine here π.PDLASMSUB-> Finds negligible subdiagonal elements.
π¨ Current Notes and/or Restrictions π¨
- This code requires the distributed block size to be square and at least six (6); unlike simpler codes like LU, this algorithm is extremely sensitive to block size. Unwise choices of too small a block size can lead to bad performance π.
- This code requires
AandZto be distributed identically and have identical contxts. A future version may allowZto have a different contxt to 1D row map it to all nodes (so no communication onZis necessary). - This release currently does not have a routine for resolving the Schur blocks into regular 2x2 form after this code is completed. Because of this, a significant performance impact is required while the deflation is done by sometimes a single column of processors π« .
- This code does not currently block the initial transforms so that none of the rows or columns for any bulge are completed until all are started. To offset pipeline start-up it is recommended that at least
2*LCM(NPROW,NPCOL)bulges are used (if possible). - The maximum number of bulges currently supported is fixed at 32. In future versions this will be limited only by the incoming
WORKandIWORKarray. - The matrix
Amust be in upper Hessenberg form. If elements below the subdiagonal are nonzero, the resulting transforms may be nonsimilar. This is also true with the LAPACK routineDLAHQRπ. - For this release, this code has only been tested for
RSRC_=CSRC_=0, but it has been written for the general case. - Currently, all the eigenvalues are distributed to all the nodes. Future releases will probably distribute the eigenvalues by the column partitioning.
- The internals of this routine are subject to change π.
- To optimize this for your architecture, try tuning
DLAREFβ¨. - This code has only been tested for
WANTZ = .TRUE.and may behave unpredictably forWANTZset to.FALSE.π.
π Implemented by π
G. Henry, May 1, 1997
and that's the whole page bestie!! π this one's from LAPACK version 1.5, dated 12 May 1997 β vintage icon behavior, honestly πβ¨
π¦ where this page comes from
- ubuntu jammy: scalapack-doc 1.5-11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms