PZLASE2(l)
๐ PZLASE2 ๐
okay bestie, gather round, because we're talking about PZLASE2, a LAPACK auxiliary routine (that's version 1.5 for the record) and she is lowkey the glow-up queen of matrix initialization. no cap. ๐ฆ
โจ NAME โจ
PZLASE2 โ initialize an M-by-N distributed matrix sub( A ) denoting A(IA:IA+M-1,JA:JA+N-1) to BETA on the diagonal and ALPHA on the offdiagonals ๐
๐ธ SYNOPSIS ๐ธ
SUBROUTINE PZLASE2( UPLO, M, N, ALPHA, BETA, A, IA, JA, DESCA )
CHARACTER UPLO
INTEGER IA, JA, M, N
COMPLEX*16 ALPHA, BETA
INTEGER DESCA( * )
COMPLEX*16 A( * )
like. look at her. so structured. so iconic. ๐
๐ PURPOSE ๐
PZLASE2 initializes an M-by-N distributed matrix sub( A ) denoting A(IA:IA+M-1,JA:JA+N-1) to BETA on the diagonal and ALPHA on the offdiagonals. and the vibe check here? PZLASE2 requires that only dimension of the matrix operand is distributed. that's the rule, bestie, we don't make the rules we just respect them ๐
๐ Notes ๐
every global data object out here has its own little description vector, and that vector is literally holding all the info you need to map an object element to its corresponding process and memory location. it's giving โจpersonal assistantโจ
let A be a generic term for any 2D block cyclicly distributed array (she's flexible, we love that). such a global array has an associated description vector DESCA. and in the following comments, the character _ should be read as "of the global array". iykyk ๐
here's the whole cast of characters, no gatekeeping:
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. ๐ญ (yes it's giving chaos, it's fine)M_A(global) โ stored inDESCA( M_ )โ the number of rows in the global array A.N_A(global) โ stored inDESCA( N_ )โ the number of columns in the global array A.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 array A is distributed.CSRC_A(global) โ stored inDESCA( CSRC_ )โ the process column over which the first column of the array A is distributed.LLD_A(local) โ stored inDESCA( LLD_ )โ the leading dimension of the local array.LLD_A >= MAX(1,LOCr(M_A)).
okay so 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.
and 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
math queen behavior fr fr ๐งฎโจ
๐ ARGUMENTS ๐
UPLOโ (global input)CHARACTER. Specifies the part of the distributed matrix sub( A ) to be set:= 'U': Upper triangular part is set; the strictly lower triangular part of sub( A ) is not changed ๐ โโ๏ธ= 'L': Lower triangular part is set; the strictly upper triangular part of sub( A ) is not changed ๐ โโ๏ธ- Otherwise: All of the matrix sub( A ) is set. (go big or go home ๐)
Mโ (global input)INTEGER. The number of rows to be operated on i.e the number of rows of the distributed submatrix sub( A ).M >= 0.Nโ (global input)INTEGER. The number of columns to be operated on i.e the number of columns of the distributed submatrix sub( A ).N >= 0.ALPHAโ (global input)COMPLEX*16. The constant to which the offdiagonal elements are to be set. ๐BETAโ (global input)COMPLEX*16. The constant to which the diagonal elements are to be set. ๐Aโ (local output)COMPLEX*16pointer into the local memory to an array of dimension(LLD_A,LOCc(JA+N-1)). This array contains the local pieces of the distributed matrix sub( A ) to be set. On exit, the leading M-by-N submatrix sub( A ) is set as follows:
if UPLO = 'U', A(IA+i-1,JA+j-1) = ALPHA, 1<=i<=j-1, 1<=j<=N,
if UPLO = 'L', A(IA+i-1,JA+j-1) = ALPHA, j+1<=i<=M, 1<=j<=N,
otherwise, A(IA+i-1,JA+j-1) = ALPHA, 1<=i<=M, 1<=j<=N,
IA+i.NE.JA+j,
and, for all UPLO, A(IA+i-1,JA+i-1) = BETA, 1<=i<=min(M,N).
IAโ (global input)INTEGER. The row index in the global array A indicating the first row of sub( A ).JAโ (global input)INTEGER. The column index in the global array A indicating the first column of sub( A ).DESCAโ (global and local input)INTEGERarray of dimensionDLEN_. The array descriptor for the distributed matrix A. ๐
bestie reminder: UPLO decides which triangle gets touched, and everything outside that triangle is left exactly as it was. no sneaky edits, no surprises. periodt. ๐
and that's the whole page, bestie!! this was LAPACK version 1.5, dated 12 May 1997 โ yes she's an elder but she still slays, and this PZLASE2(l) writeup is officially wrapped. go initialize something gorgeous. ๐โจ๐ฆ๐
๐ฆ 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