1 SUBROUTINE pslagge( M, N, D, A, IA, JA, DESCA, ISEED, ORDER, WORK,
10 INTEGER IA, INFO, JA, LWORK, M, N, ORDER
13 INTEGER DESCA( * ), ISEED( 4 )
14 REAL A( * ), D( * ), WORK( * )
169 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
170 $ mb_, nb_, rsrc_, csrc_, lld_
171 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
172 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
173 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
175 parameter( zero = 0.0e+0 )
178 INTEGER CSRC_A, DTAU1, DTAU2, I, IACOL, IAROW, ICOFFA,
179 $ iroffa, lcm, lcmq, ldaa, lq_work, lwmin, mb_a,
180 $ mp, mycol, myrow, nb_a, npcol, nprow, nq,
181 $ ptr2aa, ptr2tau, ptr2work, qr_work, rsrc_a,
182 $
SIZE, sizelqf, sizemlqright, sizemqrleft,
191 INTEGER ILCM, INDXG2P, NUMROC
192 EXTERNAL ilcm, indxg2p, numroc
199 IF( block_cyclic_2d*dlen_*dtype_*m_*n_.LT.0 )
RETURN
203 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
209 IF( nprow.EQ.-1 )
THEN
212 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 8, info )
218 rsrc_a = desca( rsrc_ )
219 csrc_a = desca( csrc_ )
220 lcm = ilcm( nprow, npcol )
222 iroffa = mod( ia-1, mb_a )
223 icoffa = mod( ja-1, nb_a )
224 iarow = indxg2p( ia, mb_a, myrow, rsrc_a, nprow )
225 iacol = indxg2p( ja, nb_a, mycol, csrc_a, npcol )
226 dtau1 = numroc( ja+size-1, nb_a, mycol, iacol, npcol )
227 dtau2 = numroc( ia+size-1, mb_a, myrow, iarow, nprow )
228 mp = numroc( m+iroffa, mb_a, myrow, iarow, nprow )
229 nq = numroc( n+icoffa, nb_a, mycol, iacol, npcol )
231 sizemqrleft =
max( ( mb_a*( mb_a-1 ) ) / 2, ( mp+nq )*mb_a ) +
233 sizemlqright =
max( ( mb_a*( mb_a-1 ) ) / 2, ( mp+nq )*mb_a ) +
235 sizeqrf = nb_a*mp + mb_a*nq + nb_a*nb_a + 100
236 sizelqf = nb_a*( mp+nq+nb_a ) + 100
238 qr_work = ldaa*
max( 1, nq ) + 200 +
max( 1, dtau1 ) +
239 $
max( sizemqrleft, sizeqrf )
240 lq_work = ldaa*
max( 1, nq ) + 200 +
max( 1, dtau2 ) +
241 $
max( sizemlqright, sizelqf )
242 lwmin =
max( qr_work, lq_work )
250 IF( size.NE.order )
THEN
252 ELSE IF( lwork.LT.lwmin )
THEN
257 CALL pxerbla( desca( ctxt_ ),
'PSLAGGE', -info )
263 CALL pslaset(
'Full', m, n, zero, zero, a, ia, ja, desca )
265 CALL pselset( a, i, i, desca, d( i ) )
271 ptr2tau = ptr2aa + ldaa*
max( 1, nq ) + 100
272 ptr2work = ptr2tau +
max( 1, dtau1 ) + 100
274 CALL pslaset(
'All', m, n, zero, zero, work( ptr2aa ), ia, ja,
279 CALL psmatgen( desca( ctxt_ ),
'N',
'N', m, n, desca( mb_ ),
280 $ desca( nb_ ), work( ptr2aa ), desca( lld_ ),
281 $ desca( rsrc_ ), desca( csrc_ ), iseed( 1 ), 0, mp,
282 $ 0, nq, myrow, mycol, nprow, npcol )
286 CALL psgeqrf( m, n, work( ptr2aa ), ia, ja, desca,
287 $ work( ptr2tau ), work( ptr2work ), sizeqrf, info )
291 CALL psormqr(
'L',
'N', m, n,
SIZE, work( ptr2aa ), ia, ja, desca,
292 $ work( ptr2tau ), a, ia, ja, desca, work( ptr2work ),
293 $ sizemqrleft, info )
298 ptr2work = ptr2tau +
max( 1, dtau2 ) + 100
302 CALL psmatgen( desca( ctxt_ ),
'N',
'N', m, n, desca( mb_ ),
303 $ desca( nb_ ), work( ptr2aa ), desca( lld_ ),
304 $ desca( rsrc_ ), desca( csrc_ ), iseed( 2 ), 0, mp,
305 $ 0, nq, myrow, mycol, nprow, npcol )
309 CALL psgelqf( m, n, work( ptr2aa ), ia, ja, desca,
310 $ work( ptr2tau ), work( ptr2work ), sizelqf, info )
314 CALL psormlq(
'R',
'N', m, n,
SIZE, work( ptr2aa ), ia, ja, desca,
315 $ work( ptr2tau ), a, ia, ja, desca, work( ptr2work ),
316 $ sizemlqright, info )