1 SUBROUTINE pdstedc( COMPZ, N, D, E, Q, IQ, JQ, DESCQ, WORK, LWORK,
2 $ IWORK, LIWORK, INFO )
11 INTEGER INFO, IQ, JQ, LIWORK, LWORK, N
14 INTEGER DESCQ( * ), IWORK( * )
15 DOUBLE PRECISION D( * ), E( * ), Q( * ), WORK( * )
120 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
121 $ mb_, nb_, rsrc_, csrc_, lld_
122 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
123 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
124 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
125 DOUBLE PRECISION ZERO, ONE
126 parameter( zero = 0.0d+0, one = 1.0d+0 )
130 INTEGER ICOFFQ, IIQ, IPQ, IQCOL, IQROW, IROFFQ, JJQ,
131 $ ldq, liwmin, lwmin, mycol, myrow, nb, np,
133 DOUBLE PRECISION ORGNRM
137 INTEGER INDXG2P, NUMROC
138 DOUBLE PRECISION DLANST
139 EXTERNAL indxg2p, lsame, numroc, dlanst
142 EXTERNAL blacs_gridinfo,
chk1mat, dlascl, dstedc,
151 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
156 CALL blacs_gridinfo( descq( ctxt_ ), nprow, npcol, myrow, mycol )
159 np = numroc( n, nb, myrow, descq( rsrc_ ), nprow )
160 nq = numroc( n, nb, mycol, descq( csrc_ ), npcol )
162 IF( nprow.EQ.-1 )
THEN
163 info = -( 600+ctxt_ )
165 CALL chk1mat( n, 2, n, 2, iq, jq, descq, 8, info )
168 iroffq = mod( iq-1, descq( mb_ ) )
169 icoffq = mod( jq-1, descq( nb_ ) )
170 iqrow = indxg2p( iq, nb, myrow, descq( rsrc_ ), nprow )
171 iqcol = indxg2p( jq, nb, mycol, descq( csrc_ ), npcol )
172 lwmin = 6*n + 2*np*nq
173 liwmin = 2 + 7*n + 8*npcol
175 work( 1 ) = dble( lwmin )
177 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
178 IF( .NOT.lsame( compz,
'I' ) )
THEN
180 ELSE IF( n.LT.0 )
THEN
182 ELSE IF( iroffq.NE.icoffq .OR. icoffq.NE.0 )
THEN
184 ELSE IF( descq( mb_ ).NE.descq( nb_ ) )
THEN
186 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
188 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery )
THEN
194 CALL pxerbla( descq( ctxt_ ),
'PDSTEDC', -info )
196 ELSE IF( lquery )
THEN
204 CALL infog2l( iq, jq, descq, nprow, npcol, myrow, mycol, iiq, jjq,
207 IF( myrow.EQ.iqrow .AND. mycol.EQ.iqcol )
217 IF( ( myrow.EQ.iqrow ) .AND. ( mycol.EQ.iqcol ) )
THEN
218 ipq = iiq + ( jjq-1 )*ldq
219 CALL dstedc(
'I', n, d, e, q( ipq ), ldq, work, lwork,
220 $ iwork, liwork, info )
231 IF( npcol*nprow.EQ.1 )
THEN
232 ipq = iiq + ( jjq-1 )*ldq
233 CALL dstedc(
'I', n, d, e, q( ipq ), ldq, work, lwork, iwork,
240 orgnrm = dlanst(
'M', n, d, e )
241 IF( orgnrm.NE.zero )
THEN
242 CALL dlascl(
'G', 0, 0, orgnrm, one, n, 1, d, n, info )
243 CALL dlascl(
'G', 0, 0, orgnrm, one, n-1, 1, e, n-1, info )
246 CALL pdlaed0( n, d, e, q, iq, jq, descq, work, iwork, info )
250 CALL pdlasrt(
'I', n, d, q, iq, jq, descq, work, lwork, iwork,
256 $
CALL dlascl(
'G', 0, 0, one, orgnrm, n, 1, d, n, info )
261 $ work( 1 ) = dble( lwmin )
263 $ iwork( 1 ) = liwmin