1 REAL FUNCTION PCQRT17( TRANS, IRESID, M, N, NRHS, A,
2 $ IA, JA, DESCA, X, IX, JX,
3 $ DESCX, B, IB, JB, DESCB, WORK,
13 INTEGER ia, ib, iresid, ix, ja, jb, jx, m, n, nrhs
16 INTEGER desca( * ), descb( * ), descx( * )
17 COMPLEX a( * ), b( * ), work( * ), x( * )
201 INTEGER block_cyclic_2d, csrc_, ctxt_, dlen_, dtype_,
202 $ lld_, mb_, m_, nb_, n_, rsrc_
203 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
204 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
205 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
207 parameter( zero = 0.0e0, one = 1.0e0 )
210 INTEGER iacol, ibcol, ibrow, icoffb, ictxt, info,
211 $ ioffa, iroffb, iscl, iw, iw2, jw, jw2, mycol,
212 $ nrhsq, nrhsp, myrow, ncols, npcol, nprow,
214 REAL err, norma, normb, normrs, normx, smlnum
217 INTEGER descw( dlen_ ), descw2( dlen_ )
238 ictxt = desca( ctxt_ )
239 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
242 IF(
lsame( trans,
'N' ) )
THEN
245 ioffa = mod( ja-1, desca( nb_ ) )
246 ELSE IF(
lsame( trans,
'C' ) )
THEN
249 ioffa = mod( ia-1, desca( mb_ ) )
251 CALL pxerbla( ictxt,
'PCQRT17', -1 )
255 IF( m.LE.0 .OR. n.LE.0 .OR. nrhs.LE.0 )
258 iroffb = mod( ia-1, desca( mb_ ) )
259 icoffb = mod( ja-1, desca( nb_ ) )
260 ibrow =
indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
262 iacol =
indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
264 ibcol =
indxg2p( jb, descb( nb_ ), mycol, descb( csrc_ ),
267 nrhsq =
numroc( nrhs+icoffb, descb( nb_ ), mycol, ibcol, npcol )
268 nrhsp =
numroc( nrhs+iroffb, descb( nb_ ), myrow, ibrow, nprow )
269 nrowsp =
numroc( nrows+iroffb, desca( mb_ ), myrow, ibrow, nprow )
274 CALL descset( descw, nrows+iroffb, nrhs+icoffb, descb( mb_ ),
275 $ descb( nb_ ), ibrow, ibcol, ictxt,
max( 1,
281 CALL descset( descw2, nrhs+icoffb, ncols+ioffa, descx( nb_ ),
282 $ descx( mb_ ), ibrow, iacol, ictxt,
max( 1,
285 norma =
pclange(
'One-norm', m, n, a, ia, ja, desca, rwork )
286 smlnum =
pslamch( ictxt,
'Safe minimum' )
287 smlnum = smlnum /
pslamch( ictxt,
'Precision' )
294 CALL pclacpy(
'All', nrows, nrhs, b, ib, jb, descb, work, iw, jw,
296 CALL pcgemm( trans,
'No transpose', nrows, nrhs, ncols,
297 $
cmplx( -one ), a, ia, ja, desca, x, ix, jx, descx,
298 $
cmplx( one ), work, iw, jw, descw )
299 normrs =
pclange(
'Max', nrows, nrhs, work, iw, jw, descw,
301 IF( normrs.GT.smlnum )
THEN
303 CALL pclascl(
'General', normrs, one, nrows, nrhs, work,
304 $ iw, jw, descw, info )
311 CALL pcgemm(
'Conjugate transpose', trans, nrhs, ncols, nrows,
312 $
cmplx( one ), work, iw, jw, descw, a, ia, ja, desca,
313 $
cmplx( zero ), work( nrowsp*nrhsq+1 ), iw2, jw2,
318 err =
pclange(
'One-norm', nrhs, ncols, work( nrowsp*nrhsq+1 ),
319 $ iw2, jw2, descw2, rwork )
326 IF( iresid.EQ.1 )
THEN
327 normb =
pclange(
'One-norm', nrows, nrhs, b, ib, jb, descb,
332 normx =
pclange(
'One-norm', ncols, nrhs, x, ix, jx, descx,
339 $ real(
max( m, n, nrhs ) ) )