1 REAL FUNCTION PSLATRA( N, A, IA, JA, DESCA )
103 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
104 $ lld_, mb_, m_, nb_, n_, rsrc_
105 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
106 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
107 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
109 parameter( zero = 0.0e+0 )
112 INTEGER icurcol, icurrow, ii, ioffa, j, jb, jj, jn,
113 $ lda, ll, mycol, myrow, npcol, nprow
117 EXTERNAL blacs_gridinfo,
infog2l, sgsum2d
130 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
138 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
141 jn =
min(
iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
144 ioffa = ii + ( jj - 1 ) * lda
148 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
149 DO 10 ll = ioffa, ioffa + (jb-1)*(lda+1), lda+1
150 trace = trace + a( ll )
153 IF( myrow.EQ.icurrow )
155 IF( mycol.EQ.icurcol )
156 $ ioffa = ioffa + jb*lda
157 icurrow = mod( icurrow+1, nprow )
158 icurcol = mod( icurcol+1, npcol )
162 DO 30 j = jn+1, ja+n-1, desca( nb_ )
163 jb =
min( ja+n-j, desca( nb_ ) )
165 IF( myrow.EQ.icurrow .AND. mycol.EQ.icurcol )
THEN
166 DO 20 ll = ioffa, ioffa + (jb-1)*(lda+1), lda+1
167 trace = trace + a( ll )
170 IF( myrow.EQ.icurrow )
172 IF( mycol.EQ.icurcol )
173 $ ioffa = ioffa + jb*lda
174 icurrow = mod( icurrow+1, nprow )
175 icurcol = mod( icurcol+1, npcol )
178 CALL sgsum2d( desca( ctxt_ ),
'All',
' ', 1, 1, trace, 1, -1,