Annotation of rpl/lapack/lapack/zhegst.f, revision 1.20

1.9       bertrand    1: *> \brief \b ZHEGST
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.16      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.9       bertrand    7: *
                      8: *> \htmlonly
1.16      bertrand    9: *> Download ZHEGST + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zhegst.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zhegst.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zhegst.f">
1.9       bertrand   15: *> [TXT]</a>
1.16      bertrand   16: *> \endhtmlonly
1.9       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZHEGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
1.16      bertrand   22: *
1.9       bertrand   23: *       .. Scalar Arguments ..
                     24: *       CHARACTER          UPLO
                     25: *       INTEGER            INFO, ITYPE, LDA, LDB, N
                     26: *       ..
                     27: *       .. Array Arguments ..
                     28: *       COMPLEX*16         A( LDA, * ), B( LDB, * )
                     29: *       ..
1.16      bertrand   30: *
1.9       bertrand   31: *
                     32: *> \par Purpose:
                     33: *  =============
                     34: *>
                     35: *> \verbatim
                     36: *>
                     37: *> ZHEGST reduces a complex Hermitian-definite generalized
                     38: *> eigenproblem to standard form.
                     39: *>
                     40: *> If ITYPE = 1, the problem is A*x = lambda*B*x,
                     41: *> and A is overwritten by inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H)
                     42: *>
                     43: *> If ITYPE = 2 or 3, the problem is A*B*x = lambda*x or
                     44: *> B*A*x = lambda*x, and A is overwritten by U*A*U**H or L**H*A*L.
                     45: *>
                     46: *> B must have been previously factorized as U**H*U or L*L**H by ZPOTRF.
                     47: *> \endverbatim
                     48: *
                     49: *  Arguments:
                     50: *  ==========
                     51: *
                     52: *> \param[in] ITYPE
                     53: *> \verbatim
                     54: *>          ITYPE is INTEGER
                     55: *>          = 1: compute inv(U**H)*A*inv(U) or inv(L)*A*inv(L**H);
                     56: *>          = 2 or 3: compute U*A*U**H or L**H*A*L.
                     57: *> \endverbatim
                     58: *>
                     59: *> \param[in] UPLO
                     60: *> \verbatim
                     61: *>          UPLO is CHARACTER*1
                     62: *>          = 'U':  Upper triangle of A is stored and B is factored as
                     63: *>                  U**H*U;
                     64: *>          = 'L':  Lower triangle of A is stored and B is factored as
                     65: *>                  L*L**H.
                     66: *> \endverbatim
                     67: *>
                     68: *> \param[in] N
                     69: *> \verbatim
                     70: *>          N is INTEGER
                     71: *>          The order of the matrices A and B.  N >= 0.
                     72: *> \endverbatim
                     73: *>
                     74: *> \param[in,out] A
                     75: *> \verbatim
                     76: *>          A is COMPLEX*16 array, dimension (LDA,N)
                     77: *>          On entry, the Hermitian matrix A.  If UPLO = 'U', the leading
                     78: *>          N-by-N upper triangular part of A contains the upper
                     79: *>          triangular part of the matrix A, and the strictly lower
                     80: *>          triangular part of A is not referenced.  If UPLO = 'L', the
                     81: *>          leading N-by-N lower triangular part of A contains the lower
                     82: *>          triangular part of the matrix A, and the strictly upper
                     83: *>          triangular part of A is not referenced.
                     84: *>
                     85: *>          On exit, if INFO = 0, the transformed matrix, stored in the
                     86: *>          same format as A.
                     87: *> \endverbatim
                     88: *>
                     89: *> \param[in] LDA
                     90: *> \verbatim
                     91: *>          LDA is INTEGER
                     92: *>          The leading dimension of the array A.  LDA >= max(1,N).
                     93: *> \endverbatim
                     94: *>
1.12      bertrand   95: *> \param[in,out] B
1.9       bertrand   96: *> \verbatim
                     97: *>          B is COMPLEX*16 array, dimension (LDB,N)
                     98: *>          The triangular factor from the Cholesky factorization of B,
                     99: *>          as returned by ZPOTRF.
1.19      bertrand  100: *>          B is modified by the routine but restored on exit.
1.9       bertrand  101: *> \endverbatim
                    102: *>
                    103: *> \param[in] LDB
                    104: *> \verbatim
                    105: *>          LDB is INTEGER
                    106: *>          The leading dimension of the array B.  LDB >= max(1,N).
                    107: *> \endverbatim
                    108: *>
                    109: *> \param[out] INFO
                    110: *> \verbatim
                    111: *>          INFO is INTEGER
                    112: *>          = 0:  successful exit
                    113: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
                    114: *> \endverbatim
                    115: *
                    116: *  Authors:
                    117: *  ========
                    118: *
1.16      bertrand  119: *> \author Univ. of Tennessee
                    120: *> \author Univ. of California Berkeley
                    121: *> \author Univ. of Colorado Denver
                    122: *> \author NAG Ltd.
1.9       bertrand  123: *
                    124: *> \ingroup complex16HEcomputational
                    125: *
                    126: *  =====================================================================
1.1       bertrand  127:       SUBROUTINE ZHEGST( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
                    128: *
1.20    ! bertrand  129: *  -- LAPACK computational routine --
1.1       bertrand  130: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    131: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    132: *
                    133: *     .. Scalar Arguments ..
                    134:       CHARACTER          UPLO
                    135:       INTEGER            INFO, ITYPE, LDA, LDB, N
                    136: *     ..
                    137: *     .. Array Arguments ..
                    138:       COMPLEX*16         A( LDA, * ), B( LDB, * )
                    139: *     ..
                    140: *
                    141: *  =====================================================================
                    142: *
                    143: *     .. Parameters ..
                    144:       DOUBLE PRECISION   ONE
                    145:       PARAMETER          ( ONE = 1.0D+0 )
                    146:       COMPLEX*16         CONE, HALF
                    147:       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ),
                    148:      $                   HALF = ( 0.5D+0, 0.0D+0 ) )
                    149: *     ..
                    150: *     .. Local Scalars ..
                    151:       LOGICAL            UPPER
                    152:       INTEGER            K, KB, NB
                    153: *     ..
                    154: *     .. External Subroutines ..
                    155:       EXTERNAL           XERBLA, ZHEGS2, ZHEMM, ZHER2K, ZTRMM, ZTRSM
                    156: *     ..
                    157: *     .. Intrinsic Functions ..
                    158:       INTRINSIC          MAX, MIN
                    159: *     ..
                    160: *     .. External Functions ..
                    161:       LOGICAL            LSAME
                    162:       INTEGER            ILAENV
                    163:       EXTERNAL           LSAME, ILAENV
                    164: *     ..
                    165: *     .. Executable Statements ..
                    166: *
                    167: *     Test the input parameters.
                    168: *
                    169:       INFO = 0
                    170:       UPPER = LSAME( UPLO, 'U' )
                    171:       IF( ITYPE.LT.1 .OR. ITYPE.GT.3 ) THEN
                    172:          INFO = -1
                    173:       ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    174:          INFO = -2
                    175:       ELSE IF( N.LT.0 ) THEN
                    176:          INFO = -3
                    177:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    178:          INFO = -5
                    179:       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
                    180:          INFO = -7
                    181:       END IF
                    182:       IF( INFO.NE.0 ) THEN
                    183:          CALL XERBLA( 'ZHEGST', -INFO )
                    184:          RETURN
                    185:       END IF
                    186: *
                    187: *     Quick return if possible
                    188: *
                    189:       IF( N.EQ.0 )
                    190:      $   RETURN
                    191: *
                    192: *     Determine the block size for this environment.
                    193: *
                    194:       NB = ILAENV( 1, 'ZHEGST', UPLO, N, -1, -1, -1 )
                    195: *
                    196:       IF( NB.LE.1 .OR. NB.GE.N ) THEN
                    197: *
                    198: *        Use unblocked code
                    199: *
                    200:          CALL ZHEGS2( ITYPE, UPLO, N, A, LDA, B, LDB, INFO )
                    201:       ELSE
                    202: *
                    203: *        Use blocked code
                    204: *
                    205:          IF( ITYPE.EQ.1 ) THEN
                    206:             IF( UPPER ) THEN
                    207: *
1.8       bertrand  208: *              Compute inv(U**H)*A*inv(U)
1.1       bertrand  209: *
                    210:                DO 10 K = 1, N, NB
                    211:                   KB = MIN( N-K+1, NB )
                    212: *
                    213: *                 Update the upper triangle of A(k:n,k:n)
                    214: *
                    215:                   CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
                    216:      $                         B( K, K ), LDB, INFO )
                    217:                   IF( K+KB.LE.N ) THEN
                    218:                      CALL ZTRSM( 'Left', UPLO, 'Conjugate transpose',
                    219:      $                           'Non-unit', KB, N-K-KB+1, CONE,
                    220:      $                           B( K, K ), LDB, A( K, K+KB ), LDA )
                    221:                      CALL ZHEMM( 'Left', UPLO, KB, N-K-KB+1, -HALF,
                    222:      $                           A( K, K ), LDA, B( K, K+KB ), LDB,
                    223:      $                           CONE, A( K, K+KB ), LDA )
                    224:                      CALL ZHER2K( UPLO, 'Conjugate transpose', N-K-KB+1,
                    225:      $                            KB, -CONE, A( K, K+KB ), LDA,
                    226:      $                            B( K, K+KB ), LDB, ONE,
                    227:      $                            A( K+KB, K+KB ), LDA )
                    228:                      CALL ZHEMM( 'Left', UPLO, KB, N-K-KB+1, -HALF,
                    229:      $                           A( K, K ), LDA, B( K, K+KB ), LDB,
                    230:      $                           CONE, A( K, K+KB ), LDA )
                    231:                      CALL ZTRSM( 'Right', UPLO, 'No transpose',
                    232:      $                           'Non-unit', KB, N-K-KB+1, CONE,
                    233:      $                           B( K+KB, K+KB ), LDB, A( K, K+KB ),
                    234:      $                           LDA )
                    235:                   END IF
                    236:    10          CONTINUE
                    237:             ELSE
                    238: *
1.8       bertrand  239: *              Compute inv(L)*A*inv(L**H)
1.1       bertrand  240: *
                    241:                DO 20 K = 1, N, NB
                    242:                   KB = MIN( N-K+1, NB )
                    243: *
                    244: *                 Update the lower triangle of A(k:n,k:n)
                    245: *
                    246:                   CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
                    247:      $                         B( K, K ), LDB, INFO )
                    248:                   IF( K+KB.LE.N ) THEN
                    249:                      CALL ZTRSM( 'Right', UPLO, 'Conjugate transpose',
                    250:      $                           'Non-unit', N-K-KB+1, KB, CONE,
                    251:      $                           B( K, K ), LDB, A( K+KB, K ), LDA )
                    252:                      CALL ZHEMM( 'Right', UPLO, N-K-KB+1, KB, -HALF,
                    253:      $                           A( K, K ), LDA, B( K+KB, K ), LDB,
                    254:      $                           CONE, A( K+KB, K ), LDA )
                    255:                      CALL ZHER2K( UPLO, 'No transpose', N-K-KB+1, KB,
                    256:      $                            -CONE, A( K+KB, K ), LDA,
                    257:      $                            B( K+KB, K ), LDB, ONE,
                    258:      $                            A( K+KB, K+KB ), LDA )
                    259:                      CALL ZHEMM( 'Right', UPLO, N-K-KB+1, KB, -HALF,
                    260:      $                           A( K, K ), LDA, B( K+KB, K ), LDB,
                    261:      $                           CONE, A( K+KB, K ), LDA )
                    262:                      CALL ZTRSM( 'Left', UPLO, 'No transpose',
                    263:      $                           'Non-unit', N-K-KB+1, KB, CONE,
                    264:      $                           B( K+KB, K+KB ), LDB, A( K+KB, K ),
                    265:      $                           LDA )
                    266:                   END IF
                    267:    20          CONTINUE
                    268:             END IF
                    269:          ELSE
                    270:             IF( UPPER ) THEN
                    271: *
1.8       bertrand  272: *              Compute U*A*U**H
1.1       bertrand  273: *
                    274:                DO 30 K = 1, N, NB
                    275:                   KB = MIN( N-K+1, NB )
                    276: *
                    277: *                 Update the upper triangle of A(1:k+kb-1,1:k+kb-1)
                    278: *
                    279:                   CALL ZTRMM( 'Left', UPLO, 'No transpose', 'Non-unit',
                    280:      $                        K-1, KB, CONE, B, LDB, A( 1, K ), LDA )
                    281:                   CALL ZHEMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ),
                    282:      $                        LDA, B( 1, K ), LDB, CONE, A( 1, K ),
                    283:      $                        LDA )
                    284:                   CALL ZHER2K( UPLO, 'No transpose', K-1, KB, CONE,
                    285:      $                         A( 1, K ), LDA, B( 1, K ), LDB, ONE, A,
                    286:      $                         LDA )
                    287:                   CALL ZHEMM( 'Right', UPLO, K-1, KB, HALF, A( K, K ),
                    288:      $                        LDA, B( 1, K ), LDB, CONE, A( 1, K ),
                    289:      $                        LDA )
                    290:                   CALL ZTRMM( 'Right', UPLO, 'Conjugate transpose',
                    291:      $                        'Non-unit', K-1, KB, CONE, B( K, K ), LDB,
                    292:      $                        A( 1, K ), LDA )
                    293:                   CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
                    294:      $                         B( K, K ), LDB, INFO )
                    295:    30          CONTINUE
                    296:             ELSE
                    297: *
1.8       bertrand  298: *              Compute L**H*A*L
1.1       bertrand  299: *
                    300:                DO 40 K = 1, N, NB
                    301:                   KB = MIN( N-K+1, NB )
                    302: *
                    303: *                 Update the lower triangle of A(1:k+kb-1,1:k+kb-1)
                    304: *
                    305:                   CALL ZTRMM( 'Right', UPLO, 'No transpose', 'Non-unit',
                    306:      $                        KB, K-1, CONE, B, LDB, A( K, 1 ), LDA )
                    307:                   CALL ZHEMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ),
                    308:      $                        LDA, B( K, 1 ), LDB, CONE, A( K, 1 ),
                    309:      $                        LDA )
                    310:                   CALL ZHER2K( UPLO, 'Conjugate transpose', K-1, KB,
                    311:      $                         CONE, A( K, 1 ), LDA, B( K, 1 ), LDB,
                    312:      $                         ONE, A, LDA )
                    313:                   CALL ZHEMM( 'Left', UPLO, KB, K-1, HALF, A( K, K ),
                    314:      $                        LDA, B( K, 1 ), LDB, CONE, A( K, 1 ),
                    315:      $                        LDA )
                    316:                   CALL ZTRMM( 'Left', UPLO, 'Conjugate transpose',
                    317:      $                        'Non-unit', KB, K-1, CONE, B( K, K ), LDB,
                    318:      $                        A( K, 1 ), LDA )
                    319:                   CALL ZHEGS2( ITYPE, UPLO, KB, A( K, K ), LDA,
                    320:      $                         B( K, K ), LDB, INFO )
                    321:    40          CONTINUE
                    322:             END IF
                    323:          END IF
                    324:       END IF
                    325:       RETURN
                    326: *
                    327: *     End of ZHEGST
                    328: *
                    329:       END

CVSweb interface <joel.bertrand@systella.fr>