1 SUBROUTINE pzqrt13( SCALE, M, N, A, IA, JA, DESCA, NORMA, ISEED,
10 INTEGER IA, ISEED, JA, M, N, SCALE
11 DOUBLE PRECISION NORMA
15 DOUBLE PRECISION WORK( * )
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.0d0 )
139 INTEGER I, IACOL, IAROW, ICOFFA, ICTXT, IIA, INFO,
140 $ iroffa, j, jja, mp, mycol, myrow, npcol,
142 DOUBLE PRECISION ASUM, BIGNUM, SMLNUM
147 DOUBLE PRECISION PDLAMCH, PZLANGE
148 EXTERNAL numroc, pdlamch,
pdlange
156 INTRINSIC dble, dcmplx, mod, 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 pzmatgen( 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 pdzasum( m, asum, a, ia, j, desca, 1 )
188 CALL pzelget(
'Column',
' ', ajj, a, i, j, desca )
189 ajj = ajj + dcmplx( sign( asum, dble( ajj ) ) )
190 CALL pzelset( a, i, j, desca, ajj )
196 IF( scale.NE.1 )
THEN
198 norma = pzlange(
'M', m, n, a, ia, ja, desca, work )
199 smlnum = pdlamch( ictxt,
'Safe minimum' )
200 bignum = one / smlnum
201 CALL pdlabad( ictxt, smlnum, bignum )
202 smlnum = smlnum / pdlamch( ictxt,
'Epsilon' )
203 bignum = one / smlnum
205 IF( scale.EQ.2 )
THEN
209 CALL pzlascl(
'General', norma, bignum, m, n, a, ia,
212 ELSE IF( scale.EQ.3 )
THEN
216 CALL pzlascl(
'General', norma, smlnum, m, n, a, ia,
223 norma = pzlange(
'One-norm', m, n, a, ia, ja, desca, work )