3 SUBROUTINE pdsepqtq( MS, NV, THRESH, Q, IQ, JQ, DESCQ, C, IC, JC,
4 $ DESCC, PROCDIST, ICLUSTR, GAP, WORK, LWORK,
13 INTEGER IC, INFO, IQ, JC, JQ, LWORK, MS, NV, RES
14 DOUBLE PRECISION QTQNRM, THRESH
18 INTEGER DESCC( * ), DESCQ( * ), ICLUSTR( * ),
20 DOUBLE PRECISION C( * ), GAP( * ), Q( * ), WORK( * )
174 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
175 $ MB_, NB_, RSRC_, CSRC_, LLD_
176 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
177 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
178 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
179 DOUBLE PRECISION ZERO, ONE, NEGONE
180 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0,
188 INTEGER CLUSTER, FIRSTP, IMAX, IMIN, JMAX, JMIN, LWMIN,
189 $ MQ0, MYCOL, MYROW, NEXTP, NP0, NPCOL, NPROW
190 DOUBLE PRECISION NORM, QTQNRM2, ULP
194 DOUBLE PRECISION PDLAMCH, PDLANGE
195 EXTERNAL numroc, pdlamch, pdlange
203 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
208 ulp = pdlamch( descc( ctxt_ ),
'P' )
210 CALL blacs_gridinfo( descc( ctxt_ ), nprow, npcol, myrow, mycol )
212 CALL chk1mat( ms, 1, ms, 2, iq, jq, descq, 7, info )
213 CALL chk1mat( nv, 1, ms, 2, ic, jc, descc, 11, info )
216 np0 = numroc( nv, descc( mb_ ), 0, 0, nprow )
217 mq0 = numroc( nv, descc( nb_ ), 0, 0, npcol )
219 lwmin = 2 +
max( descc( mb_ ), 2 )*( 2*np0+mq0 )
223 ELSE IF( jq.NE.1 )
THEN
225 ELSE IF( ic.NE.1 )
THEN
227 ELSE IF( jc.NE.1 )
THEN
229 ELSE IF( lwork.LT.lwmin )
THEN
235 CALL pxerbla( descc( ctxt_ ),
'PDSEPQTQ', -info )
241 CALL pdlaset(
'A', nv, nv, zero, one, c, ic, jc, descc )
245 IF( nv*ms.GT.0 )
THEN
246 CALL pdgemm(
'Transpose',
'N', nv, nv, ms, negone, q, 1, 1,
247 $ descq, q, 1, 1, descq, one, c, 1, 1, descc )
252 norm = pdlange(
'1', nv, nv, c, 1, 1, descc, work )
253 qtqnrm = norm / ( dble(
max( ms, 1 ) )*ulp )
257 DO 20 firstp = 1, nprow*npcol
258 IF( procdist( firstp ).GE.iclustr( 2*( cluster-1 )+1 ) )
263 imin = iclustr( 2*cluster-1 )
264 jmax = iclustr( 2*cluster )
270 DO 40 nextp = firstp, nprow*npcol
271 imax = procdist( nextp )
275 CALL pdmatadd( imax-imin+1, jmax-jmin+1, zero, c, imin, jmin,
276 $ descc, gap( cluster ) / 0.01d+0, c, imin, jmin,
278 CALL pdmatadd( jmax-jmin+1, imax-imin+1, zero, c, jmin, imin,
279 $ descc, gap( cluster ) / 0.01d+0, c, jmin, imin,
283 IF( iclustr( 2*cluster ).LT.procdist( nextp+1 ) )
288 cluster = cluster + 1
294 norm = pdlange(
'1', nv, nv, c, 1, 1, descc, work )
296 qtqnrm2 = norm / ( dble(
max( ms, 1 ) )*ulp )
298 IF( qtqnrm2.GT.thresh )
THEN