3 SUBROUTINE pchegs2( IBTYPE, UPLO, N, A, IA, JA, DESCA, B, IB, JB,
13 INTEGER IA, IB, IBTYPE, INFO, JA, JB, N
16 INTEGER DESCA( * ), DESCB( * )
17 COMPLEX 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 )
169 parameter( one = 1.0e+0, half = 0.5e+0 )
171 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
175 INTEGER IACOL, IAROW, IBCOL, IBROW, ICOFFA, ICOFFB,
176 $ ictxt, iia, iib, ioffa, ioffb, iroffa, iroffb,
177 $ jja, jjb, k, lda, ldb, mycol, myrow, npcol,
183 EXTERNAL blacs_exit, blacs_gridinfo, caxpy, cher2,
193 EXTERNAL lsame, indxg2p
197 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
202 ictxt = desca( ctxt_ )
203 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
208 IF( nprow.EQ.-1 )
THEN
209 info = -( 700+ctxt_ )
211 upper = lsame( uplo,
'U' )
212 CALL chk1mat( n, 3, n, 3, ia, ja, desca, 7, info )
213 CALL chk1mat( n, 3, n, 3, ib, jb, descb, 11, info )
215 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
217 ibrow = indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
219 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
221 ibcol = indxg2p( jb, descb( nb_ ), mycol, descb( csrc_ ),
223 iroffa = mod( ia-1, desca( mb_ ) )
224 icoffa = mod( ja-1, desca( nb_ ) )
225 iroffb = mod( ib-1, descb( mb_ ) )
226 icoffb = mod( jb-1, descb( nb_ ) )
227 IF( ibtype.LT.1 .OR. ibtype.GT.3 )
THEN
229 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
231 ELSE IF( n.LT.0 )
THEN
233 ELSE IF( n+icoffa.GT.desca( nb_ ) )
THEN
235 ELSE IF( iroffa.NE.0 )
THEN
237 ELSE IF( icoffa.NE.0 )
THEN
239 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
241 ELSE IF( iroffb.NE.0 .OR. ibrow.NE.iarow )
THEN
243 ELSE IF( icoffb.NE.0 .OR. ibcol.NE.iacol )
THEN
245 ELSE IF( descb( mb_ ).NE.desca( mb_ ) )
THEN
247 ELSE IF( descb( nb_ ).NE.desca( nb_ ) )
THEN
249 ELSE IF( ictxt.NE.descb( ctxt_ ) )
THEN
250 info = -( 1100+ctxt_ )
256 CALL pxerbla( ictxt,
'PCHEGS2', -info )
257 CALL blacs_exit( ictxt )
263 IF( n.EQ.0 .OR. ( myrow.NE.iarow .OR. mycol.NE.iacol ) )
270 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
272 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, iib, jjb,
275 IF( ibtype.EQ.1 )
THEN
279 ioffa = iia + jja*lda
280 ioffb = iib + jjb*ldb
289 akk = real( a( ioffa-lda ) )
290 bkk = real( b( ioffb-ldb ) )
294 CALL csscal( n-k, one / bkk, a( ioffa ), lda )
296 CALL clacgv( n-k, a( ioffa ), lda )
297 CALL clacgv( n-k, b( ioffb ), ldb )
298 CALL caxpy( n-k, ct, b( ioffb ), ldb, a( ioffa ),
300 CALL cher2( uplo, n-k, -cone, a( ioffa ), lda,
301 $ b( ioffb ), ldb, a( ioffa+1 ), lda )
302 CALL caxpy( n-k, ct, b( ioffb ), ldb, a( ioffa ),
304 CALL clacgv( n-k, b( ioffb ), ldb )
305 CALL ctrsv( uplo,
'Conjugate transpose',
'Non-unit',
306 $ n-k, b( ioffb+1 ), ldb, a( ioffa ), lda )
307 CALL clacgv( n-k, a( ioffa ), lda )
313 ioffa = ioffa + lda + 1
314 ioffb = ioffb + ldb + 1
320 ioffa = iia + 1 + ( jja-1 )*lda
321 ioffb = iib + 1 + ( jjb-1 )*ldb
330 akk = real( a( ioffa-1 ) )
331 bkk = real( b( ioffb-1 ) )
336 CALL csscal( n-k, one / bkk, a( ioffa ), 1 )
338 CALL caxpy( n-k, ct, b( ioffb ), 1, a( ioffa ), 1 )
339 CALL cher2( uplo, n-k, -cone, a( ioffa ), 1,
340 $ b( ioffb ), 1, a( ioffa+lda ), lda )
341 CALL caxpy( n-k, ct, b( ioffb ), 1, a( ioffa ), 1 )
342 CALL ctrsv( uplo,
'No transpose',
'Non-unit', n-k,
343 $ b( ioffb+ldb ), ldb, a( ioffa ), 1 )
349 ioffa = ioffa + lda + 1
350 ioffb = ioffb + ldb + 1
360 ioffa = iia + ( jja-1 )*lda
361 ioffb = iib + ( jjb-1 )*ldb
369 akk = real( a( ioffa+k-1 ) )
370 bkk = real( b( ioffb+k-1 ) )
371 CALL ctrmv( uplo,
'No transpose',
'Non-unit', k-1,
372 $ b( iib+( jjb-1 )*ldb ), ldb, a( ioffa ), 1 )
374 CALL caxpy( k-1, ct, b( ioffb ), 1, a( ioffa ), 1 )
375 CALL cher2( uplo, k-1, cone, a( ioffa ), 1, b( ioffb ),
376 $ 1, a( iia+( jja-1 )*lda ), lda )
377 CALL caxpy( k-1, ct, b( ioffb ), 1, a( ioffa ), 1 )
378 CALL csscal( k-1, bkk, a( ioffa ), 1 )
379 a( ioffa+k-1 ) = akk*bkk**2
391 ioffa = iia + ( jja-1 )*lda
392 ioffb = iib + ( jjb-1 )*ldb
400 akk = real( a( ioffa+( k-1 )*lda ) )
401 bkk = real( b( ioffb+( k-1 )*ldb ) )
402 CALL clacgv( k-1, a( ioffa ), lda )
403 CALL ctrmv( uplo,
'Conjugate transpose',
'Non-unit', k-1,
404 $ b( iib+( jjb-1 )*ldb ), ldb, a( ioffa ),
407 CALL clacgv( k-1, b( ioffb ), ldb )
408 CALL caxpy( k-1, ct, b( ioffb ), ldb, a( ioffa ), lda )
409 CALL cher2( uplo, k-1, cone, a( ioffa ), lda, b( ioffb ),
410 $ ldb, a( iia+( jja-1 )*lda ), lda )
411 CALL caxpy( k-1, ct, b( ioffb ), ldb, a( ioffa ), lda )
412 CALL clacgv( k-1, b( ioffb ), ldb )
413 CALL csscal( k-1, bkk, a( ioffa ), lda )
414 CALL clacgv( k-1, a( ioffa ), lda )
415 a( ioffa+( k-1 )*lda ) = akk*bkk**2