3 SUBROUTINE pzhegst( IBTYPE, UPLO, N, A, IA, JA, DESCA, B, IB, JB,
13 INTEGER IA, IB, IBTYPE, INFO, JA, JB, N
14 DOUBLE PRECISION SCALE
17 INTEGER DESCA( * ), DESCB( * )
18 COMPLEX*16 A( * ), B( * )
170 INTEGER BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
171 $ mb_, nb_, rsrc_, csrc_, lld_
172 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
173 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
174 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
176 parameter( one = 1.0d+0 )
177 COMPLEX*16 CONE, HALF
178 parameter( cone = ( 1.0d+0, 0.0d+0 ),
179 $ half = ( 0.5d+0, 0.0d+0 ) )
183 INTEGER IACOL, IAROW, IBCOL, IBROW, ICOFFA, ICOFFB,
184 $ ictxt, iroffa, iroffb, k, kb, mycol, myrow, nb,
188 INTEGER IDUM1( 2 ), IDUM2( 2 )
192 $
pzhegs2, pzhemm, pzher2k, pztrmm, pztrsm
195 INTRINSIC ichar,
min, mod
199 INTEGER ICEIL, INDXG2P
200 EXTERNAL lsame, iceil, indxg2p
204 IF( block_cyclic_2d*csrc_*ctxt_*dlen_*dtype_*lld_*mb_*m_*nb_*n_*
211 ictxt = desca( ctxt_ )
212 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
217 IF( nprow.EQ.-1 )
THEN
218 info = -( 700+ctxt_ )
220 upper = lsame( uplo,
'U' )
221 CALL chk1mat( n, 3, n, 3, ia, ja, desca, 7, info )
222 CALL chk1mat( n, 3, n, 3, ib, jb, descb, 11, info )
224 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
226 ibrow = indxg2p( ib, descb( mb_ ), myrow, descb( rsrc_ ),
228 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
230 ibcol = indxg2p( jb, descb( nb_ ), mycol, descb( csrc_ ),
232 iroffa = mod( ia-1, desca( mb_ ) )
233 icoffa = mod( ja-1, desca( nb_ ) )
234 iroffb = mod( ib-1, descb( mb_ ) )
235 icoffb = mod( jb-1, descb( nb_ ) )
236 IF( ibtype.LT.1 .OR. ibtype.GT.3 )
THEN
238 ELSE IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
240 ELSE IF( n.LT.0 )
THEN
242 ELSE IF( iroffa.NE.0 )
THEN
244 ELSE IF( icoffa.NE.0 )
THEN
246 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
248 ELSE IF( iroffb.NE.0 .OR. ibrow.NE.iarow )
THEN
250 ELSE IF( icoffb.NE.0 .OR. ibcol.NE.iacol )
THEN
252 ELSE IF( descb( mb_ ).NE.desca( mb_ ) )
THEN
254 ELSE IF( descb( nb_ ).NE.desca( nb_ ) )
THEN
256 ELSE IF( ictxt.NE.descb( ctxt_ ) )
THEN
257 info = -( 1100+ctxt_ )
263 idum1( 2 ) = ichar(
'U' )
265 idum1( 2 ) = ichar(
'L' )
268 CALL pchk2mat( n, 3, n, 3, ia, ja, desca, 7, n, 3, n, 3, ib,
269 $ jb, descb, 11, 2, idum1, idum2, info )
273 CALL pxerbla( ictxt,
'PZHEGST', -info )
282 IF( ibtype.EQ.1 )
THEN
289 kb =
min( iceil( ja, nb )*nb, ja+n-1 ) - ja + 1
295 CALL pzhegs2( ibtype, uplo, kb, a, ia+k-1, ja+k-1, desca, b,
296 $ ib+k-1, ib+k-1, descb, info )
298 CALL pztrsm(
'Left', uplo,
'Conjugate Transpose',
299 $
'Non-unit', kb, n-k-kb+1, cone, b, ib+k-1,
300 $ jb+k-1, descb, a, ia+k-1, ja+k+kb-1, desca )
301 CALL pzhemm(
'Left', uplo, kb, n-k-kb+1, -half, a,
302 $ ia+k-1, ja+k-1, desca, b, ib+k-1, jb+k+kb-1,
303 $ descb, cone, a, ia+k-1, ja+k+kb-1, desca )
304 CALL pzher2k( uplo,
'Conjugate Transpose', n-k-kb+1, kb,
305 $ -cone, a, ia+k-1, ja+k+kb-1, desca, b,
306 $ ib+k-1, jb+k+kb-1, descb, one, a,
307 $ ia+k+kb-1, ja+k+kb-1, desca )
308 CALL pzhemm(
'Left', uplo, kb, n-k-kb+1, -half, a,
309 $ ia+k-1, ja+k-1, desca, b, ib+k-1, jb+k+kb-1,
310 $ descb, cone, a, ia+k-1, ja+k+kb-1, desca )
311 CALL pztrsm(
'Right', uplo,
'No transpose',
'Non-unit',
312 $ kb, n-k-kb+1, cone, b, ib+k+kb-1, jb+k+kb-1,
313 $ descb, a, ia+k-1, ja+k+kb-1, desca )
316 kb =
min( n-k+1, nb )
327 kb =
min( iceil( ia, nb )*nb, ia+n-1 ) - ia + 1
333 CALL pzhegs2( ibtype, uplo, kb, a, ia+k-1, ja+k-1, desca, b,
334 $ ib+k-1, jb+k-1, descb, info )
336 CALL pztrsm(
'Right', uplo,
'Conjugate transpose',
337 $
'Non-unit', n-k-kb+1, kb, cone, b, ib+k-1,
338 $ jb+k-1, descb, a, ia+k+kb-1, ja+k-1, desca )
339 CALL pzhemm(
'Right', uplo, n-k-kb+1, kb, -half, a,
340 $ ia+k-1, ja+k-1, desca, b, ib+k+kb-1, jb+k-1,
341 $ descb, cone, a, ia+k+kb-1, ja+k-1, desca )
342 CALL pzher2k( uplo,
'No transpose', n-k-kb+1, kb, -cone,
343 $ a, ia+k+kb-1, ja+k-1, desca, b, ib+k+kb-1,
344 $ jb+k-1, descb, one, a, ia+k+kb-1,
346 CALL pzhemm(
'Right', uplo, n-k-kb+1, kb, -half, a,
347 $ ia+k-1, ja+k-1, desca, b, ib+k+kb-1, jb+k-1,
348 $ descb, cone, a, ia+k+kb-1, ja+k-1, desca )
349 CALL pztrsm(
'Left', uplo,
'No transpose',
'Non-unit',
350 $ n-k-kb+1, kb, cone, b, ib+k+kb-1, jb+k+kb-1,
351 $ descb, a, ia+k+kb-1, ja+k-1, desca )
354 kb =
min( n-k+1, nb )
369 kb =
min( iceil( ja, nb )*nb, ja+n-1 ) - ja + 1
375 CALL pztrmm(
'Left', uplo,
'No transpose',
'Non-unit', k-1,
376 $ kb, cone, b, ib, jb, descb, a, ia, ja+k-1,
378 CALL pzhemm(
'Right', uplo, k-1, kb, half, a, ia+k-1,
379 $ ja+k-1, desca, b, ib, jb+k-1, descb, cone, a,
380 $ ia, ja+k-1, desca )
381 CALL pzher2k( uplo,
'No transpose', k-1, kb, cone, a, ia,
382 $ ja+k-1, desca, b, ib, jb+k-1, descb, one, a,
384 CALL pzhemm(
'Right', uplo, k-1, kb, half, a, ia+k-1,
385 $ ja+k-1, desca, b, ib, jb+k-1, descb, cone, a,
386 $ ia, ja+k-1, desca )
387 CALL pztrmm(
'Right', uplo,
'Conjugate transpose',
388 $
'Non-unit', k-1, kb, cone, b, ib+k-1, jb+k-1,
389 $ descb, a, ia, ja+k-1, desca )
390 CALL pzhegs2( ibtype, uplo, kb, a, ia+k-1, ja+k-1, desca, b,
391 $ ib+k-1, jb+k-1, descb, info )
394 kb =
min( n-k+1, nb )
405 kb =
min( iceil( ia, nb )*nb, ia+n-1 ) - ia + 1
411 CALL pztrmm(
'Right', uplo,
'No transpose',
'Non-unit', kb,
412 $ k-1, cone, b, ib, jb, descb, a, ia+k-1, ja,
414 CALL pzhemm(
'Left', uplo, kb, k-1, half, a, ia+k-1, ja+k-1,
415 $ desca, b, ib+k-1, jb, descb, cone, a, ia+k-1,
417 CALL pzher2k( uplo,
'Conjugate transpose', k-1, kb, cone, a,
418 $ ia+k-1, ja, desca, b, ib+k-1, jb, descb, one,
420 CALL pzhemm(
'Left', uplo, kb, k-1, half, a, ia+k-1, ja+k-1,
421 $ desca, b, ib+k-1, jb, descb, cone, a, ia+k-1,
423 CALL pztrmm(
'Left', uplo,
'Conjugate transpose',
424 $
'Non-unit', kb, k-1, cone, b, ib+k-1, jb+k-1,
425 $ descb, a, ia+k-1, ja, desca )
426 CALL pzhegs2( ibtype, uplo, kb, a, ia+k-1, ja+k-1, desca, b,
427 $ ib+k-1, jb+k-1, descb, info )
430 kb =
min( n-k+1, nb )