PDRSCL(l)

πŸ“¦ version 1.5, in ubuntu jammy

πŸ’– PDRSCL(l) β€” LAPACK auxiliary routine, but make it make sense πŸ’–

okay so bestie, you've wandered into PDRSCL(l), which is a whole LAPACK auxiliary routine, and I am obsessed with explaining it to you. It's giving "tiny but mighty". It's giving "one job, done flawlessly". Let's go. 🫢


✨ NAME ✨

PDRSCL β€” multiplie an N-element real distributed vector sub( X ) by the real scalar 1/a πŸŽ€

(yes, "multiplie". we don't fix the ancestors' spelling, we <em>respect</em> it. periodt.)


✨ SYNOPSIS ✨

SUBROUTINE PDRSCL( N, SA, SX, IX, JX, DESCX, INCX )

    INTEGER        IX, INCX, JX, N

    DOUBLE         PRECISION SA

    INTEGER        DESCX( * )

    DOUBLE         PRECISION SX( * )

✨ PURPOSE ✨

So PDRSCL multiplies an N-element real distributed vector sub( X ) by the real scalar 1/a. πŸ’…

And the iconic part? It does this without overflow or underflow β€” as long as the final result sub( X )/a doesn't overflow or underflow. Like, it's careful. It's thoughtful. It's the friend who double-checks the group chat plans. ✨

And here's what sub( X ) actually means, literally:

where sub( X ) denotes X(IX:IX+N-1,JX:JX), if INCX = 1,
                       X(IX:IX,JX:JX+N-1), if INCX = M_X.

🌸 Notes 🌸

Each global data object is described by an associated description vector. This vector stores the info you need to map an object element to 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 comments below, read the character _ as "of the global array". 🌈

  • DT_A β€” (global) β€” stored in descA[ DT_ ] β€” the descriptor type. In this case, DT_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)).

Let K be the number of rows or columns of a distributed matrix, and assume 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

Because vectors may be seen as particular matrices, a distributed vector is considered to be a distributed matrix. πŸ‘‘


✨ ARGUMENTS ✨

  • N β€” (global input) pointer to INTEGER β€” the number of components of the distributed vector sub( X ). N >= 0. ⭐
  • SA β€” (global input) DOUBLE PRECISION β€” the scalar a which is used to divide each component of sub( X ). SA must be >= 0, or the subroutine will divide by zero. πŸ’€ (not me warning you about a literal division-by-zero. it's real. be careful.)
  • SX β€” (local input/local output) DOUBLE PRECISION array β€” contains the local pieces of a distributed matrix of dimension of at least ( (JX-1)*M_X + IX + ( N - 1 )*abs( INCX ) ). This array contains the entries of the distributed vector sub( X ). 🌸
  • IX β€” (global input) pointer to INTEGER β€” the global row index of the submatrix of the distributed matrix X to operate on.
  • JX β€” (global input) pointer to INTEGER β€” the global column index of the submatrix of the distributed matrix X to operate on.
  • DESCX β€” (global and local input) INTEGER array of dimension 8 β€” the array descriptor of the distributed matrix X. πŸŽ€
  • INCX β€” (global input) pointer to INTEGER β€” the global increment for the elements of X. Only two values of INCX are supported in this version, namely 1 and M_X. no cap, just those two. ✨

tl;dr: divide your distributed vector by a, don't let SA hit zero, and only ever pass INCX = 1 or INCX = M_X. slay responsibly. πŸ’…

okay that's the whole thing, bestie, you ate it πŸ“ β€” this was LAPACK version 1.5, dated 12 May 1997. go forth and divide with main character energy. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from