1 SUBROUTINE pcqrt13( SCALE, M, N, A, IA, JA, DESCA, NORMA, ISEED,
10 INTEGER IA, ISEED, JA, M, N, SCALE
130 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
131 $ lld_, mb_, m_, nb_, n_, rsrc_
132 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
133 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
134 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
136 parameter( one = 1.0e0 )
139 INTEGER I, IACOL, IAROW, ICOFFA, ICTXT, IIA, INFO,
140 $ iroffa, j, jja, mp, mycol, myrow, npcol,
142 REAL ASUM, BIGNUM, SMLNUM
147 REAL PCLANGE, PSLAMCH
148 EXTERNAL numroc, pclange, pslamch
156 INTRINSIC cmplx, mod, real, sign
160 ictxt = desca( ctxt_ )
161 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
163 IF( m.LE.0 .OR. n.LE.0 )
168 iroffa = mod( ia-1, desca( mb_ ) )
169 icoffa = mod( ja-1, desca( nb_ ) )
170 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia,
171 $ jja, iarow, iacol )
172 mp = numroc( m+iroffa, desca( mb_ ), myrow, iarow, nprow )
173 nq = numroc( n+icoffa, desca( nb_ ), mycol, iacol, npcol )
179 CALL pcmatgen( ictxt,
'N',
'N', desca( m_ ), desca( n_ ),
180 $ desca( mb_ ), desca( nb_ ), a, desca( lld_ ),
181 $ desca( rsrc_ ), desca( csrc_ ), iseed, iia-1, mp,
182 $ jja-1, nq, myrow, mycol, nprow, npcol )
186 IF( i.LE.ia+m-1 )
THEN
187 CALL pscasum( m, asum, a, ia, j, desca, 1 )
188 CALL pcelget(
'Column',
' ', ajj, a, i, j, desca )
189 ajj = ajj +
cmplx( sign( asum, real( ajj ) ) )
190 CALL pcelset( a, i, j, desca, ajj )
196 IF( scale.NE.1 )
THEN
198 norma = pclange(
'M', m, n, a, ia, ja, desca, work )
199 smlnum = pslamch( ictxt,
'Safe minimum' )
200 bignum = one / smlnum
201 CALL pslabad( ictxt, smlnum, bignum )
202 smlnum = smlnum / pslamch( ictxt,
'Epsilon' )
203 bignum = one / smlnum
205 IF( scale.EQ.2 )
THEN
209 CALL pclascl(
'General', norma, bignum, m, n, a, ia,
212 ELSE IF( scale.EQ.3 )
THEN
216 CALL pclascl(
'General', norma, smlnum, m, n, a, ia,
223 norma = pclange(
'One-norm', m, n, a, ia, ja, desca, work )