|
|
| |
| # lines: |
205 | | # code: |
205 | | # comment: | 0 | |
# blank: | 0 |
| # Variables: | 32 |
| # Callers: | 3 |
| # Callings: | 2 |
| # Words: | 55 |
| # Keywords: | 35 |
|
|
|
|
|
..
.. Array Arguments ..
..
Purpose
=======
PSRSCL multiplies an N-element real distributed vector sub( X ) by
the real scalar 1/a. This is done without overflow or underflow as
long as the final result sub( X )/a does not overflow or underflow.
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 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
--------------- -------------- --------------------------------------
DT_A (global) descA[ DT_ ] The descriptor type. In this case,
DT_A = 1.
CTXT_A (global) descA[ CTXT_ ] The BLACS context handle, indicating
the BLACS process grid A is distribu-
ted over. The context itself is glo-
bal, but the handle (the integer
value) may vary.
M_A (global) descA[ M_ ] The number of rows in the global
array A.
N_A (global) descA[ N_ ] The number of columns in the global
array A.
MB_A (global) descA[ MB_ ] The blocking factor used to distribu-
te the rows of the array.
NB_A (global) descA[ NB_ ] The blocking factor used to distribu-
te the columns of the array.
RSRC_A (global) descA[ RSRC_ ] The process row over which the first
row of the array A is distributed.
CSRC_A (global) descA[ CSRC_ ] The process column over which the
first column of the array A is
distributed.
LLD_A (local) 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 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 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) REAL
The scalar a which is used to divide each component of
sub( X ). SA must be >= 0, or the subroutine will divide by
zero.
SX (local input/local output) REAL array
containing 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.
=====================================================================
.. Parameters ..
|
|
|
|
01 SUBROUTINE PSRSCL( N , SA , SX , IX , JX , DESCX , INCX )
02
03 * -- ScaLAPACK auxiliary routine(version 1.7) --
04 * University of Tennessee , Knoxville , Oak Ridge National Laboratory ,
05 * and University of California , Berkeley.
06 * May 1 , 1997
07
08 * .. Scalar Arguments ..
09 INTEGER IX , INCX , JX , N
10 REAL SA
11 INTEGER BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ ,
12 $LLD_ , MB_ , M_ , NB_ , N_ , RSRC_
13 PARAMETER( BLOCK_CYCLIC_2D = 1 , DLEN_ = 9 , DTYPE_ = 1 ,
14 $CTXT_ = 2 , M_ = 3 , N_ = 4 , MB_ = 5 , NB_ = 6 ,
15 $RSRC_ = 7 , CSRC_ = 8 , LLD_ = 9 )
16 REAL ONE , ZERO
17 PARAMETER( ONE = 1.0E + 0 , ZERO = 0.0E + 0 )
18 * ..
19 * .. Local Scalars ..
20 LOGICAL DONE
21 INTEGER ICTXT , MYCOL , MYROW , NPCOL , NPROW
22 REAL BIGNUM , CDEN , CDEN1 , CNUM , CNUM1 , MUL , SMLNUM
23 * ..
24 * .. External Subroutines ..
25 EXTERNAL BLACS_GRIDINFO , PSLABAD , PSSCAL
26 * ..
27 * .. External Functions ..
28 REAL PSLAMCH
29 EXTERNAL PSLAMCH
30 * ..
31 * .. Intrinsic Functions ..
32 INTRINSIC ABS
33 * ..
34 * .. Executable Statements ..
35
36 * Get grid parameters
37
38 ICTXT = DESCX( CTXT_ )
39 CALL BLACS_GRIDINFO( ICTXT , NPROW , NPCOL , MYROW , MYCOL )
40
41 * Quick return if possible
42
43 IF( N.LE.0 )
43
44 $ RETURN
45
46 * Get machine parameters
47
48 SMLNUM = PSLAMCH( ICTXT , 'S' )
49 BIGNUM = ONE / SMLNUM
50 CALL PSLABAD ( ICTXT , SMLNUM , BIGNUM )
51
52 * Initialize the denominator to SA and the numerator to 1.
53
54 CDEN = SA
55 CNUM = ONE
56
57 10 CONTINUE
58 CDEN1 = CDEN*SMLNUM
59 CNUM1 = CNUM / BIGNUM
60 IF( ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) THEN
61
62 * Pre - multiply sub( X ) by SMLNUM if CDEN is large compared to
63 * CNUM.
64
64
65 MUL = SMLNUM
66 DONE = .FALSE.
67 CDEN = CDEN1
68 ELSE IF( ABS( CNUM1 ).GT.ABS( CDEN ) ) THEN
69
70 * Pre - multiply sub( X ) by BIGNUM if CDEN is small compared to
71 * CNUM.
72
72
73 MUL = BIGNUM
74 DONE = .FALSE.
75 CNUM = CNUM1
76 ELSE
77
78 * Multiply sub( X ) by CNUM / CDEN and return.
79
79
80 MUL = CNUM / CDEN
81 DONE = .TRUE.
82 END IF
83
84 * Scale the vector sub( X ) by MUL
85
86 CALL PSSCAL( N , MUL , SX , IX , JX , DESCX , INCX )
87
88 IF( .NOT.DONE )
88
89 $ GO TO 10
90
91 RETURN
92
93 * End of PSRSCL
94
95 END23
5
|
|
Variables in Routine PSRSCL()
| Summary Report |
| Data Type | Quantity | Size(byte) |
| INTEGER | 20 | 80 |
| LOGICAL | 1 | 1 |
| REAL | 11 | 44 |
| TOTAL | 32 | 125 |
List of Variables
INTEGER
| BLOCK_CYCLIC_2D | CSRC_ | CTXT_ | DLEN_ | DTYPE_ |
| ICTXT | INCX | IX | JX | LLD_ |
| M_ | MB_ | MYCOL | MYROW | N |
| N_ | NB_ | NPCOL | NPROW | RSRC_ |
LOGICAL
REAL
| BIGNUM | CDEN | CDEN1 | CNUM | CNUM1 |
| MUL | ONE | PSLAMCH | SA | SMLNUM |
| ZERO | | | | |
Variables Dependence Graph Put the mouse over a right hand side variable to display the corresponding line of the dependence | | - | | - | - | | BIGNUM | <--- | ONEBIGNUM = ONE / SMLNUM, SMLNUMBIGNUM = ONE / SMLNUM |
| CDEN | <--- | SACDEN = SA, CDEN1CDEN = CDEN1 |
| CDEN1 | <--- | CDENCDEN1 = CDEN*SMLNUM, SMLNUMCDEN1 = CDEN*SMLNUM |
| CNUM | <--- | ONECNUM = ONE, CNUM1CNUM = CNUM1 |
| CNUM1 | <--- | BIGNUMCNUM1 = CNUM / BIGNUM, CNUMCNUM1 = CNUM / BIGNUM |
| ICTXT | <--- | CTXT_ICTXT = DESCX( CTXT_ ) |
| MUL | <--- | BIGNUMMUL = BIGNUM, CDENMUL = CNUM / CDEN, SMLNUMMUL = SMLNUM, CNUMMUL = CNUM / CDEN |
| SMLNUM | <--- | ICTXTSMLNUM = PSLAMCH( ICTXT, 'S' ), PSLAMCHSMLNUM = PSLAMCH( ICTXT, 'S' ) |
|
|
Analysis elements of the routine PSRSCL() Put the mouse over each element to display detailed matching information
Assigned variables |
| | | BIGNUM , BLOCK_CYCLIC_2D , CDEN , CDEN1 , CNUM , CNUM1 , CSRC_ , CTXT_ , DLEN_ , DONE , DTYPE_ , ICTXT , LLD_ , M_ , MB_ , MUL , N_ , NB_ , ONE , RSRC_ , SMLNUM , ZERO |
|
Active variables |
| | | BIGNUM , BLOCK_CYCLIC_2D , CDEN , CDEN1 , CNUM , CNUM1 , CSRC_ , CTXT_ , DESCX , DLEN_ , DONE , DTYPE_ , ICTXT , INCX , IX , JX , LLD_ , M_ , MB_ , MUL , MYCOL , MYROW , N , N_ , NB_ , NPCOL , NPROW , ONE , PSLAMCH , RSRC_ , SA , SMLNUM , SX , ZERO |
|
Accessed arrays [ array name : associated index ] |
| | DESCX | : CTXT_ |
| | PSLAMCH | : ICTXT, 'S' |
|
Conditional statements [ statement : associated predicate ] |
| | if | : ( possible ) , ( N.LE.0 ) , ( (ABS( CDEN1 ).GT.ABS( CNUM ) .AND. CNUM.NE.ZERO ) ) , ( CDEN is large compared to ) , ( (ABS( CNUM1 ).GT.ABS( CDEN ) ) ) , ( CDEN is small compared to ) , ( .NOT.DONE ) |
|
| List of variables | BIGNUM BLOCK_CYCLIC_2D CDEN CDEN1 CNUM CNUM1 CSRC_
| CTXT_ DLEN_ DONE DTYPE_ ICTXT INCX IX JX
| LLD_ M_ MB_ MUL MYCOL MYROW N N_
| NB_ NPCOL NPROW ONE PSLAMCH RSRC_ SA SMLNUM
| ZERO | | close
| |
BIGNUM
BLOCK_CYCLIC_2D
CDEN
CDEN1
CNUM
CNUM1
CSRC_
CTXT_
DLEN_
DONE
DTYPE_
ICTXT
INCX
IX
JX
LLD_
M_
MB_
MUL
MYCOL
MYROW
N
N_
NB_
NPCOL
NPROW
ONE
PSLAMCH
RSRC_
SA
SMLNUM
ZERO
369#352
| |