3 SUBROUTINE pzhegs2( 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*16 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 )
171 parameter( cone = ( 1.0d+0, 0.0d+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,
179 DOUBLE PRECISION AKK, BKK
184 $
pxerbla, zaxpy, zdscal, zher2, zlacgv, ztrmv,
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,
'PZHEGS2', -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 = dble( a( ioffa-lda ) )
290 bkk = dble( b( ioffb-ldb ) )
294 CALL zdscal( n-k, one / bkk, a( ioffa ), lda )
296 CALL zlacgv( n-k, a( ioffa ), lda )
297 CALL zlacgv( n-k, b( ioffb ), ldb )
298 CALL zaxpy( n-k, ct, b( ioffb ), ldb, a( ioffa ),
300 CALL zher2( uplo, n-k, -cone, a( ioffa ), lda,
301 $ b( ioffb ), ldb, a( ioffa+1 ), lda )
302 CALL zaxpy( n-k, ct, b( ioffb ), ldb, a( ioffa ),
304 CALL zlacgv( n-k, b( ioffb ), ldb )
305 CALL ztrsv( uplo,
'Conjugate transpose',
'Non-unit',
306 $ n-k, b( ioffb+1 ), ldb, a( ioffa ), lda )
307 CALL zlacgv( 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 = dble( a( ioffa-1 ) )
331 bkk = dble( b( ioffb-1 ) )
336 CALL zdscal( n-k, one / bkk, a( ioffa ), 1 )
338 CALL zaxpy( n-k, ct, b( ioffb ), 1, a( ioffa ), 1 )
339 CALL zher2( uplo, n-k, -cone, a( ioffa ), 1,
340 $ b( ioffb ), 1, a( ioffa+lda ), lda )
341 CALL zaxpy( n-k, ct, b( ioffb ), 1, a( ioffa ), 1 )
342 CALL ztrsv( 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 = dble( a( ioffa+k-1 ) )
370 bkk = dble( b( ioffb+k-1 ) )
371 CALL ztrmv( uplo,
'No transpose',
'Non-unit', k-1,
372 $ b( iib+( jjb-1 )*ldb ), ldb, a( ioffa ), 1 )
374 CALL zaxpy( k-1, ct, b( ioffb ), 1, a( ioffa ), 1 )
375 CALL zher2( uplo, k-1, cone, a( ioffa ), 1, b( ioffb ),
376 $ 1, a( iia+( jja-1 )*lda ), lda )
377 CALL zaxpy( k-1, ct, b( ioffb ), 1, a( ioffa ), 1 )
378 CALL zdscal( 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 = dble( a( ioffa+( k-1 )*lda ) )
401 bkk = dble( b( ioffb+( k-1 )*ldb ) )
402 CALL zlacgv( k-1, a( ioffa ), lda )
403 CALL ztrmv( uplo,
'Conjugate transpose',
'Non-unit', k-1,
404 $ b( iib+( jjb-1 )*ldb ), ldb, a( ioffa ),
407 CALL zlacgv( k-1, b( ioffb ), ldb )
408 CALL zaxpy( k-1, ct, b( ioffb ), ldb, a( ioffa ), lda )
409 CALL zher2( uplo, k-1, cone, a( ioffa ), lda, b( ioffb ),
410 $ ldb, a( iia+( jja-1 )*lda ), lda )
411 CALL zaxpy( k-1, ct, b( ioffb ), ldb, a( ioffa ), lda )
412 CALL zlacgv( k-1, b( ioffb ), ldb )
413 CALL zdscal( k-1, bkk, a( ioffa ), lda )
414 CALL zlacgv( k-1, a( ioffa ), lda )
415 a( ioffa+( k-1 )*lda ) = akk*bkk**2