1 DOUBLE PRECISION FUNCTION pdlange( NORM, M, N, A, IA, JA, DESCA,
16 DOUBLE PRECISION a( * ), work( * )
148 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
149 $ lld_, mb_, m_, nb_, n_, rsrc_
150 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
151 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
152 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
153 DOUBLE PRECISION one, zero
154 parameter( one = 1.0d+0, zero = 0.0d+0 )
157 INTEGER i, iacol, iarow, ictxt, ii, icoff, ioffa,
158 $ iroff, j, jj, lda, mp, mycol, myrow, npcol,
160 DOUBLE PRECISION sum, value
163 DOUBLE PRECISION ssq( 2 ), colssq( 2 )
166 EXTERNAL blacs_gridinfo,
dcombssq, dgebr2d,
167 $ dgebs2d, dgamx2d, dgsum2d, dlassq,
176 INTRINSIC abs,
max,
min, mod, sqrt
182 ictxt = desca( ctxt_ )
183 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
185 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
187 iroff = mod( ia-1, desca( mb_ ) )
188 icoff = mod( ja-1, desca( nb_ ) )
189 mp =
numroc( m+iroff, desca( mb_ ), myrow, iarow, nprow )
190 nq =
numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
197 IF(
min( m, n ).EQ.0 )
THEN
204 ELSE IF(
lsame( norm,
'M' ) )
THEN
209 IF( nq.GT.0 .AND. mp.GT.0 )
THEN
211 DO 20 j = jj, jj+nq-1
212 DO 10 i = ii, mp+ii-1
213 VALUE =
max(
VALUE, abs( a( ioffa+i ) ) )
218 CALL dgamx2d( ictxt,
'All',
' ', 1, 1,
VALUE, 1, i, j, -1,
224 ELSE IF(
lsame( norm,
'O' ) .OR. norm.EQ.
'1' )
THEN
229 ioffa = ( jj - 1 ) * lda
230 DO 40 j = jj, jj+nq-1
233 DO 30 i = ii, mp+ii-1
234 sum = sum + abs( a( ioffa+i ) )
245 CALL dgsum2d( ictxt,
'Columnwise',
' ', 1, nq, work, 1,
250 IF( myrow.EQ.0 )
THEN
252 VALUE = work( idamax( nq, work, 1 ) )
256 CALL dgamx2d( ictxt,
'Rowwise',
' ', 1, 1,
VALUE, 1, i, j,
263 ELSE IF(
lsame( norm,
'I' ) )
THEN
268 ioffa = ii + ( jj - 1 ) * lda
269 DO 60 i = ii, ii+mp-1
272 DO 50 j = ioffa, ioffa + nq*lda - 1, lda
273 sum = sum + abs( a( j ) )
284 CALL dgsum2d( ictxt,
'Rowwise',
' ', mp, 1, work,
max( 1, mp ),
289 IF( mycol.EQ.0 )
THEN
291 VALUE = work( idamax( mp, work, 1 ) )
295 CALL dgamx2d( ictxt,
'Columnwise',
' ', 1, 1,
VALUE, 1, i,
304 ELSE IF( (
lsame( norm,
'F' ) ) .OR. (
lsame( norm,
'E' ) ) )
THEN
310 ioffa = ii + ( jj - 1 ) * lda
312 DO 70 j = ioffa, ioffa + nq*lda - 1, lda
315 CALL dlassq( mp, a( j ), 1, colssq(1), colssq(2) )
323 VALUE = ssq( 1 ) * sqrt( ssq( 2 ) )
327 IF( myrow.EQ.0 .AND. mycol.EQ.0 )
THEN
328 CALL dgebs2d( ictxt,
'All',
' ', 1, 1,
VALUE, 1 )
330 CALL dgebr2d( ictxt,
'All',
' ', 1, 1,
VALUE, 1, 0, 0 )