1 REAL FUNCTION PCLANGE( NORM, M, N, A, IA, JA, DESCA,
149 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
150 $ lld_, mb_, m_, nb_, n_, rsrc_
151 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
152 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
153 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
155 parameter( one = 1.0e+0, zero = 0.0e+0 )
158 INTEGER i, iacol, iarow, ictxt, ii, icoff, ioffa,
159 $ iroff, j, jj, lda, mp, mycol, myrow, npcol,
164 REAL ssq( 2 ), colssq( 2 )
168 $ sgebr2d, sgebs2d, sgamx2d, sgsum2d,
174 EXTERNAL lsame, isamax,
numroc
177 INTRINSIC abs,
max,
min, mod, sqrt
183 ictxt = desca( ctxt_ )
184 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
186 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
188 iroff = mod( ia-1, desca( mb_ ) )
189 icoff = mod( ja-1, desca( nb_ ) )
190 mp =
numroc( m+iroff, desca( mb_ ), myrow, iarow, nprow )
191 nq =
numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
198 IF(
min( m, n ).EQ.0 )
THEN
205 ELSE IF( lsame( norm,
'M' ) )
THEN
210 IF( nq.GT.0 .AND. mp.GT.0 )
THEN
212 DO 20 j = jj, jj+nq-1
213 DO 10 i = ii, mp+ii-1
214 VALUE =
max(
VALUE, abs( a( ioffa+i ) ) )
219 CALL sgamx2d( ictxt,
'All',
' ', 1, 1,
VALUE, 1, i, j, -1,
225 ELSE IF( lsame( norm,
'O' ) .OR. norm.EQ.
'1' )
THEN
230 ioffa = ( jj - 1 ) * lda
231 DO 40 j = jj, jj+nq-1
234 DO 30 i = ii, mp+ii-1
235 sum = sum + abs( a( ioffa+i ) )
246 CALL sgsum2d( ictxt,
'Columnwise',
' ', 1, nq, work, 1,
251 IF( myrow.EQ.0 )
THEN
253 VALUE = work( isamax( nq, work, 1 ) )
257 CALL sgamx2d( ictxt,
'Rowwise',
' ', 1, 1,
VALUE, 1, i, j,
264 ELSE IF( lsame( norm,
'I' ) )
THEN
269 ioffa = ii + ( jj - 1 ) * lda
270 DO 60 i = ii, ii+mp-1
273 DO 50 j = ioffa, ioffa + nq*lda - 1, lda
274 sum = sum + abs( a( j ) )
285 CALL sgsum2d( ictxt,
'Rowwise',
' ', mp, 1, work,
max( 1, mp ),
290 IF( mycol.EQ.0 )
THEN
292 VALUE = work( isamax( mp, work, 1 ) )
296 CALL sgamx2d( ictxt,
'Columnwise',
' ', 1, 1,
VALUE, 1, i,
305 ELSE IF( ( lsame( norm,
'F' ) ) .OR. ( lsame( norm,
'E' ) ) )
THEN
311 ioffa = ii + ( jj - 1 ) * lda
313 DO 70 j = ioffa, ioffa + nq*lda - 1, lda
316 CALL classq( mp, a( j ), 1, colssq(1), colssq(2) )
324 VALUE = ssq( 1 ) * sqrt( ssq( 2 ) )
328 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
329 CALL sgebs2d( ictxt,
'All',
' ', 1, 1,
VALUE, 1 )
331 CALL sgebr2d( ictxt,
'All',
' ', 1, 1,
VALUE, 1, 0, 0 )