1 DOUBLE PRECISION FUNCTION pzqrt14( TRANS, M, N, NRHS, A, IA, JA,
2 $ DESCA, X, IX, JX, DESCX, WORK )
11 INTEGER ia, ix, ja, jx, m, n, nrhs
14 INTEGER desca( * ), descx( * )
15 COMPLEX*16 a( * ), work( * ), x( * )
173 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
174 $ lld_, mb_, m_, nb_, n_, rsrc_
175 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
176 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
177 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
178 DOUBLE PRECISION one, zero
179 parameter( zero = 0.0d+0, one = 1.0d+0 )
183 INTEGER iacol, iarow, icoffa, ictxt, idum, iia, info,
184 $ iptau, ipw, ipwa, iroffa, iwa, iwx, j, jja,
185 $ jwa, jwx, ldw, lwork, mpwa, mpw, mqw, mycol,
186 $ myrow, npcol, nprow, npw, nqwa, nqw
187 DOUBLE PRECISION anrm, err, xnrm
191 INTEGER descw( dlen_ ), idum1( 1 ), idum2( 1 )
192 DOUBLE PRECISION rwork( 1 )
206 INTRINSIC abs, dble,
max,
min, mod
212 ictxt = desca( ctxt_ )
213 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
218 iroffa = mod( ia-1, desca( mb_ ) )
219 icoffa = mod( ja-1, desca( nb_ ) )
222 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia,
223 $ jja, iarow, iacol )
224 mpwa =
numroc( m+iroffa, desca( mb_ ), myrow, iarow, nprow )
225 nqwa =
numroc( n+icoffa, desca( nb_ ), mycol, iacol, npcol )
228 IF(
lsame( trans,
'N' ) )
THEN
229 IF( n.LE.0 .OR. nrhs.LE.0 )
232 mpw =
numroc( m+nrhs+iroffa, desca( mb_ ), myrow, iarow,
242 CALL descset( descw, m+nrhs+iroffa, n+icoffa, desca( mb_ ),
243 $ desca( nb_ ), iarow, iacol, ictxt, ldw )
245 ELSE IF(
lsame( trans,
'C' ) )
THEN
246 IF( m.LE.0 .OR. nrhs.LE.0 )
250 nqw =
numroc( n+nrhs+icoffa, desca( nb_ ), mycol, iacol,
259 CALL descset( descw, m+iroffa, n+nrhs+icoffa, desca( mb_ ),
260 $ desca( nb_ ), iarow, iacol, ictxt, ldw )
262 CALL pxerbla( ictxt,
'PZQRT14', -1 )
268 iptau = ipwa + mpw*nqw
269 CALL pzlacpy(
'All', m, n, a, ia, ja, desca, work( ipwa ), iwa,
272 anrm =
pzlange(
'M', m, n, work( ipwa ), iwa, jwa, descw, rwork )
274 $
CALL pzlascl(
'G', anrm, one, m, n, work( ipwa ), iwa,
284 CALL pzcopy( m, x, ix, jx+j-1, descx, 1, work( ipwa ), iwx,
285 $ jwx+j-1, descw, 1 )
287 xnrm =
pzlange(
'M', m, nrhs, work( ipwa ), iwx, jwx, descw,
290 $
CALL pzlascl(
'G', xnrm, one, m, nrhs, work( ipwa ), iwx,
295 mqw =
numroc( m+icoffa, desca( nb_ ), mycol, iacol, npcol )
296 ipw = iptau +
min( mqw, nqw )
297 lwork = descw( nb_ ) * ( mpw + nqw + descw( nb_ ) )
298 CALL pzgeqrf( m, n+nrhs, work( ipwa ), iwa, jwa, descw,
299 $ work( iptau ), work( ipw ), lwork, info )
306 DO 20 j = jwx, jwa+n+nrhs-1
307 CALL pzmax1(
min(m-n,j-jwx+1), amax, idum, work( ipwa ),
308 $ iwa+n, j, descw, 1 )
309 err =
max( err, abs( amax ) )
312 CALL dgamx2d( ictxt,
'All',
' ', 1, 1, err, 1, idum1, idum2,
320 CALL pzcopy( n, x, ix, jx+j-1, descx, 1, work( ipwa ),
321 $ iwx+j-1, jwx, descw, descw( m_ ) )
322 CALL pzlacgv( n, work( ipwa ), iwx+j-1, jwx, descw,
326 xnrm =
pzlange(
'M', nrhs, n, work( ipwa ), iwx, jwx, descw,
329 $
CALL pzlascl(
'G', xnrm, one, nrhs, n, work( ipwa ), iwx,
334 npw =
numroc( n+iroffa, desca( mb_ ), myrow, iarow, nprow )
335 ipw = iptau +
min( mpw, npw )
336 lwork = descw( mb_ ) * ( mpw + nqw + descw( mb_ ) )
337 CALL pzgelqf( m+nrhs, n, work( ipwa ), iwa, jwa, descw,
338 $ work( iptau ), work( ipw ), lwork, info )
344 DO 40 j = jwa+m,
min( jwa+n-1, jwa+m+nrhs-1 )
345 CALL pzmax1( jwa+m+nrhs-j, amax, idum, work( ipwa ),
346 $ iwx+j-jwa-m, j, descw, 1 )
347 err =
max( err, abs( amax ) )
349 CALL dgamx2d( ictxt,
'All',
' ', 1, 1, err, 1, idum1, idum2,
355 $
pdlamch( ictxt,
'Epsilon' ) )