3 SUBROUTINE pdsygs2( IBTYPE, UPLO, N, A, IA, JA, DESCA, B, IB, JB,
13 INTEGER IA, IB, IBTYPE, INFO, JA, JB, N
16 INTEGER DESCA( * ), DESCB( * )
17 DOUBLE PRECISION A( * ), B( * )
163 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
164 $ mb_, nb_, rsrc_, csrc_, lld_
165 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
166 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
167 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
168 DOUBLE PRECISION ONE, HALF
169 parameter( one = 1.0d+0, half = 0.5d+0 )
173 INTEGER IACOL, IAROW, IBCOL, IBROW, ICOFFA, ICOFFB,
174 $ ictxt, iia, iib, ioffa, ioffb, iroffa, iroffb,
175 $ jja, jjb, k, lda, ldb, mycol, myrow, npcol,
177 DOUBLE PRECISION AKK, BKK, CT
180 EXTERNAL blacs_exit, blacs_gridinfo,
chk1mat, daxpy,
189 EXTERNAL lsame, indxg2p
193 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
198 ictxt = desca( ctxt_ )
199 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
204 IF( nprow.EQ.-1 )
THEN
205 info = -( 700+ctxt_ )
207 upper = lsame( uplo,
'U' )
208 CALL chk1mat( n, 3, n, 3, ia, ja, desca, 7, info )
209 CALL chk1mat( n, 3, n, 3, ib, jb, descb, 11, info )
211 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
213 ibrow = indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
215 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
217 ibcol = indxg2p( jb, descb( nb_ ), mycol, descb( csrc_ ),
219 iroffa = mod( ia-1, desca( mb_ ) )
220 icoffa = mod( ja-1, desca( nb_ ) )
221 iroffb = mod( ib-1, descb( mb_ ) )
222 icoffb = mod( jb-1, descb( nb_ ) )
223 IF( ibtype.LT.1 .OR. ibtype.GT.3 )
THEN
225 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
227 ELSE IF( n.LT.0 )
THEN
229 ELSE IF( n+icoffa.GT.desca( nb_ ) )
THEN
231 ELSE IF( iroffa.NE.0 )
THEN
233 ELSE IF( icoffa.NE.0 )
THEN
235 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
237 ELSE IF( iroffb.NE.0 .OR. ibrow.NE.iarow )
THEN
239 ELSE IF( icoffb.NE.0 .OR. ibcol.NE.iacol )
THEN
241 ELSE IF( descb( mb_ ).NE.desca( mb_ ) )
THEN
243 ELSE IF( descb( nb_ ).NE.desca( nb_ ) )
THEN
245 ELSE IF( ictxt.NE.descb( ctxt_ ) )
THEN
246 info = -( 1100+ctxt_ )
252 CALL pxerbla( ictxt,
'PDSYGS2', -info )
253 CALL blacs_exit( ictxt )
259 IF( n.EQ.0 .OR. ( myrow.NE.iarow .OR. mycol.NE.iacol ) )
266 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
268 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iib, jjb,
271 IF( ibtype.EQ.1 )
THEN
275 ioffa = iia + jja*lda
276 ioffb = iib + jjb*ldb
290 CALL dscal( n-k, one / bkk, a( ioffa ), lda )
292 CALL daxpy( n-k, ct, b( ioffb ), ldb, a( ioffa ),
294 CALL dsyr2( uplo, n-k, -one, a( ioffa ), lda,
295 $ b( ioffb ), ldb, a( ioffa+1 ), lda )
296 CALL daxpy( n-k, ct, b( ioffb ), ldb, a( ioffa ),
298 CALL dtrsv( uplo,
'Transpose',
'Non-unit', n-k,
299 $ b( ioffb+1 ), ldb, a( ioffa ), lda )
305 ioffa = ioffa + lda + 1
306 ioffb = ioffb + ldb + 1
312 ioffa = iia + 1 + ( jja-1 )*lda
313 ioffb = iib + 1 + ( jjb-1 )*ldb
328 CALL dscal( n-k, one / bkk, a( ioffa ), 1 )
330 CALL daxpy( n-k, ct, b( ioffb ), 1, a( ioffa ), 1 )
331 CALL dsyr2( uplo, n-k, -one, a( ioffa ), 1,
332 $ b( ioffb ), 1, a( ioffa+lda ), lda )
333 CALL daxpy( n-k, ct, b( ioffb ), 1, a( ioffa ), 1 )
334 CALL dtrsv( uplo,
'No transpose',
'Non-unit', n-k,
335 $ b( ioffb+ldb ), ldb, a( ioffa ), 1 )
341 ioffa = ioffa + lda + 1
342 ioffb = ioffb + ldb + 1
352 ioffa = iia + ( jja-1 )*lda
353 ioffb = iib + ( jjb-1 )*ldb
363 CALL dtrmv( uplo,
'No transpose',
'Non-unit', k-1,
364 $ b( iib+( jjb-1 )*ldb ), ldb, a( ioffa ), 1 )
366 CALL daxpy( k-1, ct, b( ioffb ), 1, a( ioffa ), 1 )
367 CALL dsyr2( uplo, k-1, one, a( ioffa ), 1, b( ioffb ), 1,
368 $ a( iia+( jja-1 )*lda ), lda )
369 CALL daxpy( k-1, ct, b( ioffb ), 1, a( ioffa ), 1 )
370 CALL dscal( k-1, bkk, a( ioffa ), 1 )
371 a( ioffa+k-1 ) = akk*bkk**2
383 ioffa = iia + ( jja-1 )*lda
384 ioffb = iib + ( jjb-1 )*ldb
392 akk = a( ioffa+( k-1 )*lda )
393 bkk = b( ioffb+( k-1 )*ldb )
394 CALL dtrmv( uplo,
'Transpose',
'Non-unit', k-1,
395 $ b( iib+( jjb-1 )*ldb ), ldb, a( ioffa ),
398 CALL daxpy( k-1, ct, b( ioffb ), ldb, a( ioffa ), lda )
399 CALL dsyr2( uplo, k-1, one, a( ioffa ), lda, b( ioffb ),
400 $ ldb, a( iia+( jja-1 )*lda ), lda )
401 CALL daxpy( k-1, ct, b( ioffb ), ldb, a( ioffa ), lda )
402 CALL dscal( k-1, bkk, a( ioffa ), lda )
403 a( ioffa+( k-1 )*lda ) = akk*bkk**2