3 SUBROUTINE pslagsy( N, K, D, A, IA, JA, DESCA, ISEED, ORDER, WORK,
13 INTEGER IA, INFO, JA, K, LWORK, N, ORDER
16 INTEGER DESCA( * ), ISEED( 4 )
17 REAL A( * ), D( * ), WORK( * )
144 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
145 $ mb_, nb_, rsrc_, csrc_, lld_
146 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
147 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
148 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
150 parameter( zero = 0.0e+0 )
153 INTEGER CSRC_A, I, IACOL, IAROW, ICOFFA, II, IIROW,
154 $ indaa, indtau, indwork, ipostpad, iprepad,
155 $ iroffa, isizesubtst, isizesyevx, isizetst,
156 $ jjcol, ldaa, lii, liii, ljj, ljjj, lwmin, maxi,
157 $ mb_a, mycol, myrow, nb_a, np, npcol, nprow, nq,
158 $ rsrc_a, sizechk, sizemqrleft, sizemqrright,
159 $ sizeqrf, sizeqtq, sizesubtst, sizesyevx,
167 INTEGER INDXG2P, NUMROC
168 EXTERNAL indxg2p, numroc
176 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
181 CALL blacs_gridinfo( desca( ctxt_ ), nprow, npcol, myrow, mycol )
186 IF( nprow.EQ.-1 )
THEN
187 info = -( 700+ctxt_ )
189 CALL chk1mat( n, 1, n, 1, ia, ja, desca, 7, info )
195 rsrc_a = desca( rsrc_ )
196 csrc_a = desca( csrc_ )
197 iarow = indxg2p( ia, mb_a, myrow, rsrc_a, nprow )
198 iacol = indxg2p( ja, nb_a, mycol, csrc_a, npcol )
199 iroffa = mod( ia-1, mb_a )
200 icoffa = mod( ja-1, nb_a )
201 np = numroc( n+iroffa, mb_a, myrow, iarow, nprow )
202 nq = numroc( n+icoffa, nb_a, mycol, iacol, npcol )
205 CALL pslasizesep( desca, iprepad, ipostpad, sizemqrleft,
206 $ sizemqrright, sizeqrf, sizetms, sizeqtq,
207 $ sizechk, sizesyevx, isizesyevx, sizesubtst,
208 $ isizesubtst, sizetst, isizetst )
214 IF( k.LT.0 .OR. k.GT.n-1 )
THEN
216 ELSE IF( n.NE.order )
THEN
218 ELSE IF( lwork.LT.lwmin )
THEN
223 CALL pxerbla( desca( ctxt_ ),
'PSLAGSY', -info )
228 indtau = indaa + ldaa*
max( 1, nq )
229 indwork = indtau +
max( 1, nq )
232 CALL slaset(
'A', ldaa, nq, zero, zero, work( indaa ), ldaa )
238 CALL psmatgen( desca( ctxt_ ),
'N',
'N', n, order,
239 $ desca( mb_ ), desca( nb_ ), work( indaa ),
240 $ desca( lld_ ), desca( rsrc_ ), desca( csrc_ ),
241 $ iseed( 1 ), 0, np, 0, nq, myrow, mycol, nprow,
243 CALL psgeqrf( n, order, work( indaa ), ia, ja, desca,
244 $ work( indtau ), work( indwork ), sizeqrf, info )
250 CALL slaset(
'A', np, nq, zero, zero, a, desca( lld_ ) )
257 DO 20 ii = 1, n, desca( mb_ )
258 maxi =
min( n, ii+desca( mb_ )-1 )
259 IF( ( myrow.EQ.iirow ) .AND. ( mycol.EQ.jjcol ) )
THEN
263 a( liii+( ljjj-1 )*desca( lld_ ) ) = d( i )
269 $ lii = lii + desca( mb_ )
271 $ ljj = ljj + desca( mb_ )
272 iirow = mod( iirow+1, nprow )
273 jjcol = mod( jjcol+1, npcol )
280 CALL psormqr(
'L',
'Transpose', n, n, order, work( indaa ), ia,
281 $ ja, desca, work( indtau ), a, ia, ja, desca,
282 $ work( indwork ), sizemqrleft, info )
288 CALL psormqr(
'R',
'N', n, n, order, work( indaa ), ia, ja,
289 $ desca, work( indtau ), a, ia, ja, desca,
290 $ work( indwork ), sizemqrright, info )