1 SUBROUTINE pslasrt( ID, N, D, Q, IQ, JQ, DESCQ, WORK, LWORK,
2 $ IWORK, LIWORK, INFO )
10 INTEGER INFO, IQ, JQ, LIWORK, LWORK, N
13 INTEGER DESCQ( * ), IWORK( * )
14 REAL D( * ), Q( * ), WORK( * )
79 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
80 $ mb_, nb_, rsrc_, csrc_, lld_
81 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
82 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
83 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
86 INTEGER CL, COL, DUMMY, I, ICTXT, IID, IIQ, INDCOL,
87 $ indx, indxc, indxg, ipq, ipq2, ipw, ipwork, j,
88 $ jjq, k, l, ldq, lend, liwmin, lwmin, mycol,
89 $ myrow, nb, nd, np, npcol, nprow, nq, psq, qcol,
94 INTEGER INDXG2L, INDXG2P, NUMROC
95 EXTERNAL indxg2l, indxg2p, lsame, numroc
99 $ sgerv2d, sgesd2d, slamov,
slapst
107 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
113 ictxt = descq( ctxt_ )
114 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
119 IF( nprow.EQ.-1 )
THEN
120 info = -( 600+ctxt_ )
122 CALL chk1mat( n, 1, n, 1, iq, jq, descq, 6, info )
126 np = numroc( n, nb, myrow, descq( rsrc_ ), nprow )
127 nq = numroc( n, nb, mycol, descq( csrc_ ), npcol )
128 lwmin =
max( n, np*( nb+nq ) )
129 liwmin = n + 2*( nb+npcol )
130 IF( .NOT.lsame( id,
'I' ) )
THEN
132 ELSE IF( n.LT.0 )
THEN
134 ELSE IF( lwork.LT.lwmin )
THEN
136 ELSE IF( liwork.LT.liwmin )
THEN
143 CALL pxerbla( ictxt,
'PSLASRT', -info )
161 iiq = indxg2l( iq, nb, dummy, dummy, nprow )
165 CALL slapst(
'I', n, d, iwork( indx ), info )
168 work( iid+l ) = d( iwork( indx+l ) )
169 iwork( indxc-1+iwork( indx+l ) ) = iid + l
171 CALL scopy( n, work, 1, d, 1 )
176 lend =
min( nb, n-nd )
178 qcol = indxg2p( j, nb, dummy, descq( csrc_ ), npcol )
180 DO 30 l = 0, lend - 1
181 i = jq - 1 + iwork( indxc+nd+l )
182 cl = indxg2p( i, nb, dummy, descq( csrc_ ), npcol )
183 iwork( indcol+l ) = cl
184 IF( mycol.EQ.cl )
THEN
185 iwork( indxg+k ) = iwork( indxc+nd+l )
190 IF( mycol.EQ.qcol )
THEN
191 DO 40 cl = 0, npcol - 1
194 DO 50 l = 0, lend - 1
195 iwork( qtot+iwork( indcol+l ) ) = iwork( qtot+
196 $ iwork( indcol+l ) ) + 1
199 DO 60 cl = 1, npcol - 1
200 iwork( psq+cl ) = iwork( psq+cl-1 ) + iwork( qtot+cl-1 )
202 DO 70 l = 0, lend - 1
203 cl = iwork( indcol+l )
205 jjq = indxg2l( i, nb, dummy, dummy, npcol )
206 ipq = iiq + ( jjq-1 )*ldq
207 ipwork = ipw + ( iwork( psq+cl )-1 )*np
208 CALL scopy( np, q( ipq ), 1, work( ipwork ), 1 )
209 iwork( psq+cl ) = iwork( psq+cl ) + 1
212 DO 80 cl = 1, npcol - 1
213 iwork( psq+cl ) = iwork( psq+cl-1 ) + iwork( qtot+cl-1 )
217 jjq = indxg2l( i, nb, dummy, dummy, npcol )
218 ipq = ipq2 + ( jjq-1 )*np
219 ipwork = ipw + ( iwork( psq+mycol )-1 )*np
220 CALL scopy( np, work( ipwork ), 1, work( ipq ), 1 )
221 iwork( psq+mycol ) = iwork( psq+mycol ) + 1
223 DO 100 cl = 1, npcol - 1
224 col = mod( mycol+cl, npcol )
225 sbuf = iwork( qtot+col )
227 ipwork = ipw + ( iwork( psq+col )-1 )*np
228 CALL sgesd2d( descq( ctxt_ ), np, sbuf,
229 $ work( ipwork ), np, myrow, col )
236 CALL sgerv2d( descq( ctxt_ ), np, k, work( ipw ), np,
239 i = jq - 1 + iwork( indxg+l )
240 jjq = indxg2l( i, nb, dummy, dummy, npcol )
241 ipq = 1 + ( jjq-1 )*np
243 CALL scopy( np, work( ipwork ), 1, work( ipq ), 1 )
250 CALL slamov(
'Full', np, nq, work, np, q( iiq ), ldq )