PDLASSQ(l)
π PDLASSQ β bestie edition π
okay so this is a LAPACK auxiliary routine, PDLASSQ (it lives in the l manual, if the (l) wasn't a giveaway π
), and it's from LAPACK version 1.5. Strap in, we're doing scaled sums of squares but make it distributed.
β¨ NAME β¨
PDLASSQ β she returns the values scl and smsq such that
( scl**2 )*smsq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq,
like. that's the whole vibe. π«Ά
π SYNOPSIS π
SUBROUTINE PDLASSQ( N, X, IX, JX, DESCX, INCX, SCALE, SUMSQ )
INTEGER IX, INCX, JX, N
DOUBLE PRECISION SCALE, SUMSQ
INTEGER DESCX( * )
DOUBLE PRECISION X( * )
π PURPOSE π
so PDLASSQ returns the values scl and smsq such that
where
x( i ) = sub( X ) = X( IX+(JX-1)*DESCX(M_)+(i-1)*INCX ).
The value of sumsq is assumed to be non-negative, and scl returns the value
scl = max( scale, abs( x( i ) ) ).
scale and sumsq must be supplied in SCALE and SUMSQ respectively. SCALE and SUMSQ are overwritten by scl and ssq respectively.
The routine makes only one pass through the vector sub( X ). one pass, no re-reads, she's efficient like that β
π 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".
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 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)).
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
Because vectors may be viewed as a subclass of matrices, a distributed vector is considered to be a distributed matrix. (yes bestie, a vector is just a matrix with main character energy π)
β οΈ The result are only available in the scope ofsub( X ), i.e ifsub( X )is distributed along a process row, the correct results are only available in this process row of the grid. Similarly ifsub( X )is distributed along a process column, the correct results are only available in this process column of the grid.
like. don't go looking for those results outside their grid neighborhood, fr fr π
π¦ ARGUMENTS π¦
Nβ (global input)INTEGER. The length of the distributed vectorsub( X ).Xβ (input)DOUBLE PRECISION. The vector for which a scaled sum of squares is computed.x( i ) = X(IX+(JX-1)*M_X +(i-1)*INCX ), 1 <= i <= n.IXβ (global input)INTEGER. The row index in the global arrayXindicating the first row ofsub( X ).JXβ (global input)INTEGER. The column index in the global arrayXindicating the first column ofsub( X ).DESCXβ (global and local input)INTEGERarray of dimensionDLEN_. The array descriptor for the distributed matrixX.INCXβ (global input)INTEGER. The global increment for the elements ofX. Only two values ofINCXare supported in this version, namely1andM_X.INCXmust not be zero. (zero is not the move, bestie π)SCALEβ (local input/local output)DOUBLE PRECISION. On entry, the valuescalein the equation above. On exit,SCALEis overwritten withscl, the scaling factor for the sum of squares.SUMSQβ (local input/local output)DOUBLE PRECISION. On entry, the valuesumsqin the equation above. On exit,SUMSQis overwritten withsmsq, the basic sum of squares from whichsclhas been factored out.
and that's the whole page, periodt π This was LAPACK version 1.5, dated 12 May 1997 β yeah she's vintage, she's an icon, she's serving 1997 LAPACK auxiliary routine realness πβ¨ slay π«Ά
π¦ 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