|
|
| |
| # lines: |
741 | | # code: |
741 | | # comment: | 0 | |
# blank: | 0 |
| # Variables: | 32 |
| # Callers: | 0 |
| # Callings: | 0 |
| # Words: | 186 |
| # Keywords: | 77 |
|
|
|
|
|
..
.. Local Scalars ..
..
.. Local Arrays ..
..
.. External Subroutines ..
..
.. External Functions ..
..
.. Intrinsic Functions ..
..
.. Executable Statements ..
Get grid parameters.
Find max(abs(A(i,j))).
Only one process row
Handle first block of columns separately
Loop over remaining block of columns
Handle first block of columns separately
Loop over remaining block of columns
Gather the intermediate results to process (0,0).
Only one process row
Handle first block of columns separately
Loop over remaining block of columns
Handle first block of columns separately
Loop over remaining block of columns
Find sum of global matrix columns and store on row 0 of
process grid
Find maximum sum of columns for 1-norm
Only one process row
Handle first block of columns separately
Loop over remaining block of columns
Handle first block of columns separately
Loop over remaining block of columns
Find sum of global matrix rows and store on column 0 of
process grid
Find maximum sum of rows for Infinity-norm
Only one process row
Handle first block of columns separately
|
|
|
|
001 REAL FUNCTION PCLANHS( NORM , N , A , IA , JA , DESCA ,
002 $WORK )
003
004 * -- ScaLAPACK auxiliary routine(version 1.7) --
005 * University of Tennessee , Knoxville , Oak Ridge National Laboratory ,
006 * and University of California , Berkeley.
007 * May 1 , 1997
008
009 * .. Scalar Arguments ..
010 CHARACTER NORM
011 INTEGER IA , JA , N
012 * ..
013 * .. Array Arguments ..
014 INTEGER DESCA( * )
015 REAL WORK( * )
016 COMPLEX A( * )
017 * ..
018
019 * Purpose
020 * === ====
021
022 * PCLANHS returns the value of the one norm , or the Frobenius norm ,
023 * or the infinity norm , or the element of largest absolute value of a
024 * Hessenberg distributed matrix sub( A ) = A(IA : IA + N - 1 , JA : JA + N - 1).
025
026 * PCLANHS returns the value
027
028 * ( max(abs(A(i , j))) , NORM = 'M' or 'm' with IA <= i <= IA + N - 1 ,
029 * ( and JA <= j <= JA + N - 1 ,
030 * (
031 * ( norm1( sub( A ) ) , NORM = '1' , 'O' or 'o'
032 * (
033 * ( normI( sub( A ) ) , NORM = 'I' or 'i'
034 * (
035 * ( normF( sub( A ) ) , NORM = 'F' , 'f' , 'E' or 'e'
036
037 * where norm1 denotes the one norm of a matrix(maximum column sum) ,
038 * normI denotes the infinity norm of a matrix(maximum row sum) and
039 * normF denotes the Frobenius norm of a matrix(square root of sum of
040 * squares). Note that max(abs(A(i , j))) is not a matrix norm.
041
042 * Notes
043 * === ==
044
045 * Each global data object is described by an associated description
046 * vector. This vector stores the information required to establish
047 * the mapping between an object element and its corresponding process
048 * and memory location.
049
050 * Let A be a generic term for any 2D block cyclicly distributed array.
051 * Such a global array has an associated description vector DESCA.
052 * In the following comments , the character _ should be read as
053 * "of the global array".
054
055 * NOTATION STORED IN EXPLANATION
056 * --- ------------ -------------- --------------------------------------
057 * DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case ,
058 * DTYPE_A = 1.
059 * CTXT_A(global) DESCA( CTXT_ ) The BLACS context handle , indicating
060 * the BLACS process grid A is distribu -
061 * ted over. The context itself is glo -
062 * bal , but the handle(the integer
063 * value) may vary.
064 * M_A(global) DESCA( M_ ) The number of rows in the global
065 * array A.
066 * N_A(global) DESCA( N_ ) The number of columns in the global
067 * array A.
068 * MB_A(global) DESCA( MB_ ) The blocking factor used to distribute
069 * the rows of the array.
070 * NB_A(global) DESCA( NB_ ) The blocking factor used to distribute
071 * the columns of the array.
072 * RSRC_A(global) DESCA( RSRC_ ) The process row over which the first
073 * row of the array A is distributed.
074 * CSRC_A(global) DESCA( CSRC_ ) The process column over which the
075 * first column of the array A is
076 * distributed.
077 * LLD_A(local) DESCA( LLD_ ) The leading dimension of the local
078 * array. LLD_A >= MAX(1 , LOCr(M_A)).
079
080 * Let K be the number of rows or columns of a distributed matrix ,
081 * and assume that its process grid has dimension p x q.
082 * LOCr( K ) denotes the number of elements of K that a process
083 * would receive if K were distributed over the p processes of its
084 * process column.
085 * Similarly , LOCc( K ) denotes the number of elements of K that a
086 * process would receive if K were distributed over the q processes of
087 * its process row.
088 * The values of LOCr() and LOCc() may be determined via a call to the
089 * ScaLAPACK tool function , NUMROC :
090 * LOCr( M ) = NUMROC( M , MB_A , MYROW , RSRC_A , NPROW ) ,
091 * LOCc( N ) = NUMROC( N , NB_A , MYCOL , CSRC_A , NPCOL ).
092 * An upper bound for these quantities may be computed by :
093 * LOCr( M ) <= ceil( ceil(M / MB_A) / NPROW )*MB_A
094 * LOCc( N ) <= ceil( ceil(N / NB_A) / NPCOL )*NB_A
095
096 * Arguments
097 * === ======
098
099 * NORM(global input) CHARACTER
100 * Specifies the value to be returned in PCLANHS as described
101 * above.
102
103 * N(global input) INTEGER
104 * The number of rows and columns to be operated on i.e the
105 * number of rows and columns of the distributed submatrix
106 * sub( A ). When N = 0 , PCLANHS is set to zero. N >= 0.
107
108 * A(local input) COMPLEX pointer into the local memory
109 * to an array of dimension(LLD_A , LOCc(JA + N - 1) ) containing
110 * the local pieces of sub( A ).
111
112 * IA(global input) INTEGER
113 * The row index in the global array A indicating the first
114 * row of sub( A ).
115
116 * JA(global input) INTEGER
117 * The column index in the global array A indicating the
118 * first column of sub( A ).
119
120 * DESCA(global and local input) INTEGER array of dimension DLEN_.
121 * The array descriptor for the distributed matrix A.
122
123 * WORK(local workspace) REAL array dimension(LWORK)
124 * LWORK >= 0 if NORM = 'M' or 'm'(not referenced) ,
125 * Nq0 if NORM = '1' , 'O' or 'o' ,
126 * Mp0 if NORM = 'I' or 'i' ,
127 * 0 if NORM = 'F' , 'f' , 'E' or 'e'(not referenced) ,
128 * where
129
130 * IROFFA = MOD( IA - 1 , MB_A ) , ICOFFA = MOD( JA - 1 , NB_A ) ,
131 * IAROW = INDXG2P( IA , MB_A , MYROW , RSRC_A , NPROW ) ,
132 * IACOL = INDXG2P( JA , NB_A , MYCOL , CSRC_A , NPCOL ) ,
133 * Np0 = NUMROC( N + IROFFA , MB_A , MYROW , IAROW , NPROW ) ,
134 * Nq0 = NUMROC( N + ICOFFA , NB_A , MYCOL , IACOL , NPCOL ) ,
135
136 * INDXG2P and NUMROC are ScaLAPACK tool functions ; MYROW ,
137 * MYCOL , NPROW and NPCOL can be determined by calling the
138 * subroutine BLACS_GRIDINFO.
139
140 * === ==================================================================
141
142 * .. Parameters ..
143 INTEGER BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ ,
144 $LLD_ , MB_ , M_ , NB_ , N_ , RSRC_
145 PARAMETER( BLOCK_CYCLIC_2D = 1 , DLEN_ = 9 , DTYPE_ = 1 ,
146 $CTXT_ = 2 , M_ = 3 , N_ = 4 , MB_ = 5 , NB_ = 6 ,
147 $RSRC_ = 7 , CSRC_ = 8 , LLD_ = 9 )
148 REAL ONE , ZERO
149 PARAMETER( ONE = 1.0E + 0 , ZERO = 0.0E + 0 )
150 IACOL = MOD( IACOL + 1 , NPCOL )
151
152 * Loop over remaining block of columns
153
154 DO 460 J = JN + 1 , JA + N - 1 , DESCA( NB_ )
154
155 JB = MIN( JA + N - J , DESCA( NB_ ) )
156
157 IF( MYCOL.EQ.IACOL ) THEN
157
158 DO 450 LL = JJ , JJ + JB - 1
158
159 CALL CLASSQ( MIN( II + LL - JJ + 1 , IIA + NP - 1 ) - IIA + 1 ,
160 $ A( IIA + IOFFA ) , 1 , SCALE , SUM )
161 IOFFA = IOFFA + LDA
162 450 CONTINUE
162
163 JJ = JJ + JB
164 END IF
165
166 II = II + JB
167 IACOL = MOD( IACOL + 1 , NPCOL )
168
169 460 CONTINUE
170
171 ELSE
172
173 * Handle first block of columns separately
174
174
175 INXTROW = MOD( IAROW + 1 , NPROW )
176 IF( MYCOL.EQ.IACOL ) THEN
176
177 IF( MYROW.EQ.IAROW ) THEN
177
178 DO 470 LL = JJ , JJ + JB - 1
178
179 CALL CLASSQ( MIN( II + LL - JJ + 1 , IIA + NP - 1 ) - IIA + 1 ,
180 $ A( IIA + IOFFA ) , 1 , SCALE , SUM )
181 IOFFA = IOFFA + LDA
182 470 CONTINUE
182
183 ELSE
183
184 DO 480 LL = JJ , JJ + JB - 1
184
185 CALL CLASSQ( MIN( II - 1 , IIA + NP - 1 ) - IIA + 1 ,
186 $ A( IIA + IOFFA ) , 1 , SCALE , SUM )
187 IOFFA = IOFFA + LDA
188 480 CONTINUE
188
189 IF( MYROW.EQ.INXTROW .AND. II.LE.IIA + NP - 1 )
189
190 $ CALL CLASSQ( 1 , A( II + (JJ + JB - 2)*LDA ) , 1 ,
191 $ SCALE , SUM )
192 END IF
193 JJ = JJ + JB
194 END IF
195
196 IF( MYROW.EQ.IAROW )
196
197 $ II = II + JB
198 IAROW = INXTROW
199 IAROW = MOD( IAROW + 1 , NPROW )
200 IACOL = MOD( IACOL + 1 , NPCOL )
201
202 * Loop over remaining block of columns
203
204 DO 510 J = JN + 1 , JA + N - 1 , DESCA( NB_ )
204
205 JB = MIN( JA + N - J , DESCA( NB_ ) )
206
207 IF( MYCOL.EQ.IACOL ) THEN
207
208 IF( MYROW.EQ.IAROW ) THEN
208
209 DO 490 LL = JJ , JJ + JB - 1
209
210 CALL CLASSQ( MIN( II + LL - JJ + 1 , IIA + NP - 1 ) - IIA + 1 ,
211 $ A( IIA + IOFFA ) , 1 , SCALE , SUM )
212 IOFFA = IOFFA + LDA
213 490 CONTINUE
213
214 ELSE
214
215 DO 500 LL = JJ , JJ + JB - 1
215
216 CALL CLASSQ( MIN( II - 1 , IIA + NP - 1 ) - IIA + 1 ,
217 $ A( IIA + IOFFA ) , 1 , SCALE , SUM )
218 IOFFA = IOFFA + LDA
219 500 CONTINUE
219
220 IF( MYROW.EQ.INXTROW .AND. II.LE.IIA + NP - 1 )
220
221 $ CALL CLASSQ( 1 , A( II + (JJ + JB - 2)*LDA ) , 1 ,
222 $ SCALE , SUM )
223 END IF
224 JJ = JJ + JB
225 END IF
226
227 IF( MYROW.EQ.IAROW )
227
228 $ II = II + JB
229 IAROW = INXTROW
230 IAROW = MOD( IAROW + 1 , NPROW )
231 IACOL = MOD( IACOL + 1 , NPCOL )
232
233 510 CONTINUE
234
234
235 END IF
236
237 * Perform the global scaled sum
238
239 RWORK( 1 ) = SCALE
240 RWORK( 2 ) = SUM
241 CALL PSTREECOMB( ICTXT , 'All' , 2 , RWORK , 0 , 0 , SCOMBSSQ )
242 VALUE = RWORK( 1 ) * SQRT( RWORK( 2 ) )
243
244 END IF
245
246 IF( MYROW.EQ.0 .AND. MYCOL.EQ.0 ) THEN
246
247 CALL SGEBS2D( ICTXT , 'All' , ' ' , 1 , 1 , VALUE , 1 )
248 ELSE
248
249 CALL SGEBR2D( ICTXT , 'All' , ' ' , 1 , 1 , VALUE , 1 , 0 , 0 )
250 END IF
251
252 PCLANHS = VALUE
253
254 RETURN
255
256 * End of PCLANHS
257
258 END47
27
|
|
Variables in Routine PCLANHS()
| Summary Report |
| Data Type | Quantity | Size(byte) |
| CHARACTER | 1 | 1 |
| COMPLEX | 1 | 4 |
| INTEGER | 24 | 96 |
| REAL | 6 | 24 |
| TOTAL | 32 | 125 |
List of Variables
CHARACTER
COMPLEX
INTEGER
| BLOCK_CYCLIC_2D | CSRC_ | CTXT_ | DESCA( * ) | DLEN_ |
| DTYPE_ | IA | IACOL | IAROW | II |
| INXTROW | IOFFA | J | JA | JB |
| JJ | LL | LLD_ | M_ | MB_ |
| N | N_ | NB_ | RSRC_ | |
REAL
| ONE | PCLANHS | RWORK | VALUE | WORK( * ) |
| ZERO | | | | |
Variables Dependence Graph Put the mouse over a right hand side variable to display the corresponding line of the dependence | | - | | - | - | | IACOL | <--- | IACOLIACOL = MOD( IACOL+1, NPCOL ){2IACOL = MOD( IACOL+1, NPCOL ), 3IACOL = MOD( IACOL+1, NPCOL ), 4IACOL = MOD( IACOL+1, NPCOL )} |
| IAROW | <--- | IAROWIAROW = MOD( IAROW+1, NPROW ){2IAROW = MOD( IAROW+1, NPROW )}, INXTROWIAROW = INXTROW{2IAROW = INXTROW} |
| II | <--- | IIII = II + JB, JBII = II + JB |
| INXTROW | <--- | IAROWINXTROW = MOD( IAROW+1, NPROW ) |
| IOFFA | <--- | IOFFAIOFFA = IOFFA + LDA{2IOFFA = IOFFA + LDA, 3IOFFA = IOFFA + LDA, 4IOFFA = IOFFA + LDA, 5IOFFA = IOFFA + LDA} |
| J | <--- | JADO 460 J = JN+1, JA+N-1, DESCA( NB_ ){2DO 510 J = JN+1, JA+N-1, DESCA( NB_ )}, NDO 460 J = JN+1, JA+N-1, DESCA( NB_ ){2DO 510 J = JN+1, JA+N-1, DESCA( NB_ )}, NB_DO 460 J = JN+1, JA+N-1, DESCA( NB_ ){2DO 510 J = JN+1, JA+N-1, DESCA( NB_ )}, DESCADO 460 J = JN+1, JA+N-1, DESCA( NB_ ){2DO 510 J = JN+1, JA+N-1, DESCA( NB_ )} |
| JB | <--- | JJB = MIN( JA+N-J, DESCA( NB_ ) ){2JB = MIN( JA+N-J, DESCA( NB_ ) )}, JAJB = MIN( JA+N-J, DESCA( NB_ ) ){2JB = MIN( JA+N-J, DESCA( NB_ ) )}, NJB = MIN( JA+N-J, DESCA( NB_ ) ){2JB = MIN( JA+N-J, DESCA( NB_ ) )}, NB_JB = MIN( JA+N-J, DESCA( NB_ ) ){2JB = MIN( JA+N-J, DESCA( NB_ ) )}, DESCAJB = MIN( JA+N-J, DESCA( NB_ ) ){2JB = MIN( JA+N-J, DESCA( NB_ ) )} |
| JJ | <--- | JBJJ = JJ + JB{2JJ = JJ + JB, 3JJ = JJ + JB}, JJJJ = JJ + JB{2JJ = JJ + JB, 3JJ = JJ + JB} |
| LL | <--- | JBDO 450 LL = JJ, JJ+JB-1{2DO 470 LL = JJ, JJ + JB -1, 3DO 480 LL = JJ, JJ + JB -1, 4DO 490 LL = JJ, JJ + JB -1, 5DO 500 LL = JJ, JJ + JB -1}, JJDO 450 LL = JJ, JJ+JB-1{2DO 470 LL = JJ, JJ + JB -1, 3DO 480 LL = JJ, JJ + JB -1, 4DO 490 LL = JJ, JJ + JB -1, 5DO 500 LL = JJ, JJ + JB -1} |
| PCLANHS | <--- | VALUEPCLANHS = VALUE |
| VALUE | <--- | RWORKVALUE = RWORK( 1 ) * SQRT( RWORK( 2 ) ) |
|
|
Analysis elements of the routine PCLANHS() Put the mouse over each element to display detailed matching information
Assigned variables |
| | | A , BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ , IA , IACOL , IAROW , II , INXTROW , IOFFA , j , JA , JB , JJ , LL , LLD_ , M_ , MB_ , N , N_ , NB_ , NORM , ONE , PCLANHS , RSRC_ , RWORK , VALUE , ZERO |
|
Active variables |
| | | A , BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DESCA , DLEN_ , DTYPE_ , IA , IACOL , IAROW , II , INXTROW , IOFFA , j , JA , JB , JJ , LL , LLD_ , M_ , MB_ , N , N_ , NB_ , NORM , one , PCLANHS , RSRC_ , RWORK , value , WORK , zero |
|
Accessed arrays [ array name : associated index ] |
| | A | : * , i,j , i,j , IA:IA+N-1,JA:JA+N-1 , II+(JJ+JB-2)*LDA , II+(JJ+JB-2)*LDA , IIA+IOFFA , IIA+IOFFA , IIA+IOFFA , IIA+IOFFA , IIA+IOFFA |
| | DESCA | : * , CSRC_ , CTXT_ , DTYPE_ , LLD_ , M_ , MB_ , N_ , NB_ , NB_ , NB_ , NB_ , NB_ , RSRC_ |
| | RWORK | : 1 , 1 , 2 , 2 |
| | WORK | : * |
|
Conditional statements [ statement : associated predicate ] |
| | do | : ( 460 J = JN + 1 , JA + N - 1 , DESCA( NB_ ) ) , ( 450 LL = JJ , JJ + JB - 1 ) , ( 470 LL = JJ , JJ + JB - 1 ) , ( 480 LL = JJ , JJ + JB - 1 ) , ( 510 J = JN + 1 , JA + N - 1 , DESCA( NB_ ) ) , ( 490 LL = JJ , JJ + JB - 1 ) , ( 500 LL = JJ , JJ + JB - 1 ) |
| | for | : ( any 2D block cyclicly distributed array. ) , ( these quantities may be computed by : ) , ( the distributed matrix A. ) |
| | if | : ( K were distributed over the p processes of its ) , ( K were distributed over the q processes of ) , ( NORM = 'M' or 'm' (not referenced) , ) , ( NORM = '1' , 'O' or 'o' , ) , ( NORM = 'I' or 'i' , ) , ( NORM = 'F' , 'f' , 'E' or 'e' (not referenced) , ) , ( MYCOL.EQ.IACOL ) , ( MYCOL.EQ.IACOL ) , ( MYROW.EQ.IAROW ) , ( MYROW.EQ.INXTROW .AND. II.LE.IIA + NP - 1 ) , ( MYROW.EQ.IAROW ) , ( MYCOL.EQ.IACOL ) , ( MYROW.EQ.IAROW ) , ( MYROW.EQ.INXTROW .AND. II.LE.IIA + NP - 1 ) , ( MYROW.EQ.IAROW ) , ( MYROW.EQ.0 .AND. MYCOL.EQ.0 ) |
|
| List of variables | A( * ) BLOCK_CYCLIC_2D CSRC_ CTXT_ DESCA( * ) DLEN_ DTYPE_
| IA IACOL IAROW II INXTROW IOFFA J JA
| JB JJ LL LLD_ M_ MB_ N N_
| NB_ NORM ONE PCLANHS RSRC_ RWORK VALUE WORK( * )
| ZERO | | close
| |
A( * )
BLOCK_CYCLIC_2D
CSRC_
CTXT_
DESCA( * )
DLEN_
DTYPE_
IA
IACOL
IAROW
II
INXTROW
IOFFA
J
JA
JB
JJ
LL
LLD_
M_
MB_
N
N_
NB_
NORM
ONE
PCLANHS
RSRC_
RWORK
VALUE
WORK( * )
ZERO
| |