1 REAL FUNCTION PCQRT14( 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 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 )
179 parameter( zero = 0.0e+0, one = 1.0e+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
191 INTEGER descw( dlen_ ), idum1( 1 ), idum2( 1 )
206 INTRINSIC abs,
max,
min, mod, real
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,
'PCQRT14', -1 )
268 iptau = ipwa + mpw*nqw
269 CALL pclacpy(
'All', m, n, a, ia, ja, desca, work( ipwa ), iwa,
272 anrm =
pclange(
'M', m, n, work( ipwa ), iwa, jwa, descw, rwork )
274 $
CALL pclascl(
'G', anrm, one, m, n, work( ipwa ), iwa,
284 CALL pccopy( m, x, ix, jx+j-1, descx, 1, work( ipwa ), iwx,
285 $ jwx+j-1, descw, 1 )
287 xnrm =
pclange(
'M', m, nrhs, work( ipwa ), iwx, jwx, descw,
290 $
CALL pclascl(
'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 pcgeqrf( 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 pcmax1(
min(m-n,j-jwx+1), amax, idum, work( ipwa ),
308 $ iwa+n, j, descw, 1 )
309 err =
max( err, abs( amax ) )
312 CALL sgamx2d( ictxt,
'All',
' ', 1, 1, err, 1, idum1, idum2,
320 CALL pccopy( n, x, ix, jx+j-1, descx, 1, work( ipwa ),
321 $ iwx+j-1, jwx, descw, descw( m_ ) )
322 CALL pclacgv( n, work( ipwa ), iwx+j-1, jwx, descw,
326 xnrm =
pclange(
'M', nrhs, n, work( ipwa ), iwx, jwx, descw,
329 $
CALL pclascl(
'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 pcgelqf( 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 pcmax1( jwa+m+nrhs-j, amax, idum, work( ipwa ),
346 $ iwx+j-jwa-m, j, descw, 1 )
347 err =
max( err, abs( amax ) )
349 CALL sgamx2d( ictxt,
'All',
' ', 1, 1, err, 1, idum1, idum2,
355 $
pslamch( ictxt,
'Epsilon' ) )