Annotation of rpl/lapack/lapack/zsytf2.f, revision 1.11

1.9       bertrand    1: *> \brief \b ZSYTF2
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
                      5: * Online html documentation available at 
                      6: *            http://www.netlib.org/lapack/explore-html/ 
                      7: *
                      8: *> \htmlonly
                      9: *> Download ZSYTF2 + dependencies 
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zsytf2.f"> 
                     11: *> [TGZ]</a> 
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zsytf2.f"> 
                     13: *> [ZIP]</a> 
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zsytf2.f"> 
                     15: *> [TXT]</a>
                     16: *> \endhtmlonly 
                     17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZSYTF2( UPLO, N, A, LDA, IPIV, INFO )
                     22: * 
                     23: *       .. Scalar Arguments ..
                     24: *       CHARACTER          UPLO
                     25: *       INTEGER            INFO, LDA, N
                     26: *       ..
                     27: *       .. Array Arguments ..
                     28: *       INTEGER            IPIV( * )
                     29: *       COMPLEX*16         A( LDA, * )
                     30: *       ..
                     31: *  
                     32: *
                     33: *> \par Purpose:
                     34: *  =============
                     35: *>
                     36: *> \verbatim
                     37: *>
                     38: *> ZSYTF2 computes the factorization of a complex symmetric matrix A
                     39: *> using the Bunch-Kaufman diagonal pivoting method:
                     40: *>
                     41: *>    A = U*D*U**T  or  A = L*D*L**T
                     42: *>
                     43: *> where U (or L) is a product of permutation and unit upper (lower)
                     44: *> triangular matrices, U**T is the transpose of U, and D is symmetric and
                     45: *> block diagonal with 1-by-1 and 2-by-2 diagonal blocks.
                     46: *>
                     47: *> This is the unblocked version of the algorithm, calling Level 2 BLAS.
                     48: *> \endverbatim
                     49: *
                     50: *  Arguments:
                     51: *  ==========
                     52: *
                     53: *> \param[in] UPLO
                     54: *> \verbatim
                     55: *>          UPLO is CHARACTER*1
                     56: *>          Specifies whether the upper or lower triangular part of the
                     57: *>          symmetric matrix A is stored:
                     58: *>          = 'U':  Upper triangular
                     59: *>          = 'L':  Lower triangular
                     60: *> \endverbatim
                     61: *>
                     62: *> \param[in] N
                     63: *> \verbatim
                     64: *>          N is INTEGER
                     65: *>          The order of the matrix A.  N >= 0.
                     66: *> \endverbatim
                     67: *>
                     68: *> \param[in,out] A
                     69: *> \verbatim
                     70: *>          A is COMPLEX*16 array, dimension (LDA,N)
                     71: *>          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
                     72: *>          n-by-n upper triangular part of A contains the upper
                     73: *>          triangular part of the matrix A, and the strictly lower
                     74: *>          triangular part of A is not referenced.  If UPLO = 'L', the
                     75: *>          leading n-by-n lower triangular part of A contains the lower
                     76: *>          triangular part of the matrix A, and the strictly upper
                     77: *>          triangular part of A is not referenced.
                     78: *>
                     79: *>          On exit, the block diagonal matrix D and the multipliers used
                     80: *>          to obtain the factor U or L (see below for further details).
                     81: *> \endverbatim
                     82: *>
                     83: *> \param[in] LDA
                     84: *> \verbatim
                     85: *>          LDA is INTEGER
                     86: *>          The leading dimension of the array A.  LDA >= max(1,N).
                     87: *> \endverbatim
                     88: *>
                     89: *> \param[out] IPIV
                     90: *> \verbatim
                     91: *>          IPIV is INTEGER array, dimension (N)
                     92: *>          Details of the interchanges and the block structure of D.
                     93: *>          If IPIV(k) > 0, then rows and columns k and IPIV(k) were
                     94: *>          interchanged and D(k,k) is a 1-by-1 diagonal block.
                     95: *>          If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and
                     96: *>          columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
                     97: *>          is a 2-by-2 diagonal block.  If UPLO = 'L' and IPIV(k) =
                     98: *>          IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were
                     99: *>          interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
                    100: *> \endverbatim
                    101: *>
                    102: *> \param[out] INFO
                    103: *> \verbatim
                    104: *>          INFO is INTEGER
                    105: *>          = 0: successful exit
                    106: *>          < 0: if INFO = -k, the k-th argument had an illegal value
                    107: *>          > 0: if INFO = k, D(k,k) is exactly zero.  The factorization
                    108: *>               has been completed, but the block diagonal matrix D is
                    109: *>               exactly singular, and division by zero will occur if it
                    110: *>               is used to solve a system of equations.
                    111: *> \endverbatim
                    112: *
                    113: *  Authors:
                    114: *  ========
                    115: *
                    116: *> \author Univ. of Tennessee 
                    117: *> \author Univ. of California Berkeley 
                    118: *> \author Univ. of Colorado Denver 
                    119: *> \author NAG Ltd. 
                    120: *
                    121: *> \date November 2011
                    122: *
                    123: *> \ingroup complex16SYcomputational
                    124: *
                    125: *> \par Further Details:
                    126: *  =====================
                    127: *>
                    128: *> \verbatim
                    129: *>
                    130: *>  If UPLO = 'U', then A = U*D*U**T, where
                    131: *>     U = P(n)*U(n)* ... *P(k)U(k)* ...,
                    132: *>  i.e., U is a product of terms P(k)*U(k), where k decreases from n to
                    133: *>  1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
                    134: *>  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
                    135: *>  defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
                    136: *>  that if the diagonal block D(k) is of order s (s = 1 or 2), then
                    137: *>
                    138: *>             (   I    v    0   )   k-s
                    139: *>     U(k) =  (   0    I    0   )   s
                    140: *>             (   0    0    I   )   n-k
                    141: *>                k-s   s   n-k
                    142: *>
                    143: *>  If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
                    144: *>  If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
                    145: *>  and A(k,k), and v overwrites A(1:k-2,k-1:k).
                    146: *>
                    147: *>  If UPLO = 'L', then A = L*D*L**T, where
                    148: *>     L = P(1)*L(1)* ... *P(k)*L(k)* ...,
                    149: *>  i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
                    150: *>  n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
                    151: *>  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
                    152: *>  defined by IPIV(k), and L(k) is a unit lower triangular matrix, such
                    153: *>  that if the diagonal block D(k) is of order s (s = 1 or 2), then
                    154: *>
                    155: *>             (   I    0     0   )  k-1
                    156: *>     L(k) =  (   0    I     0   )  s
                    157: *>             (   0    v     I   )  n-k-s+1
                    158: *>                k-1   s  n-k-s+1
                    159: *>
                    160: *>  If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
                    161: *>  If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
                    162: *>  and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).
                    163: *> \endverbatim
                    164: *
                    165: *> \par Contributors:
                    166: *  ==================
                    167: *>
                    168: *> \verbatim
                    169: *>
                    170: *>  09-29-06 - patch from
                    171: *>    Bobby Cheng, MathWorks
                    172: *>
                    173: *>    Replace l.209 and l.377
                    174: *>         IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
                    175: *>    by
                    176: *>         IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. DISNAN(ABSAKK) ) THEN
                    177: *>
                    178: *>  1-96 - Based on modifications by J. Lewis, Boeing Computer Services
                    179: *>         Company
                    180: *> \endverbatim
                    181: *
                    182: *  =====================================================================
1.1       bertrand  183:       SUBROUTINE ZSYTF2( UPLO, N, A, LDA, IPIV, INFO )
                    184: *
1.9       bertrand  185: *  -- LAPACK computational routine (version 3.4.0) --
1.1       bertrand  186: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    187: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.9       bertrand  188: *     November 2011
1.1       bertrand  189: *
                    190: *     .. Scalar Arguments ..
                    191:       CHARACTER          UPLO
                    192:       INTEGER            INFO, LDA, N
                    193: *     ..
                    194: *     .. Array Arguments ..
                    195:       INTEGER            IPIV( * )
                    196:       COMPLEX*16         A( LDA, * )
                    197: *     ..
                    198: *
                    199: *  =====================================================================
                    200: *
                    201: *     .. Parameters ..
                    202:       DOUBLE PRECISION   ZERO, ONE
                    203:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
                    204:       DOUBLE PRECISION   EIGHT, SEVTEN
                    205:       PARAMETER          ( EIGHT = 8.0D+0, SEVTEN = 17.0D+0 )
                    206:       COMPLEX*16         CONE
                    207:       PARAMETER          ( CONE = ( 1.0D+0, 0.0D+0 ) )
                    208: *     ..
                    209: *     .. Local Scalars ..
                    210:       LOGICAL            UPPER
                    211:       INTEGER            I, IMAX, J, JMAX, K, KK, KP, KSTEP
                    212:       DOUBLE PRECISION   ABSAKK, ALPHA, COLMAX, ROWMAX
                    213:       COMPLEX*16         D11, D12, D21, D22, R1, T, WK, WKM1, WKP1, Z
                    214: *     ..
                    215: *     .. External Functions ..
                    216:       LOGICAL            DISNAN, LSAME
                    217:       INTEGER            IZAMAX
                    218:       EXTERNAL           DISNAN, LSAME, IZAMAX
                    219: *     ..
                    220: *     .. External Subroutines ..
                    221:       EXTERNAL           XERBLA, ZSCAL, ZSWAP, ZSYR
                    222: *     ..
                    223: *     .. Intrinsic Functions ..
                    224:       INTRINSIC          ABS, DBLE, DIMAG, MAX, SQRT
                    225: *     ..
                    226: *     .. Statement Functions ..
                    227:       DOUBLE PRECISION   CABS1
                    228: *     ..
                    229: *     .. Statement Function definitions ..
                    230:       CABS1( Z ) = ABS( DBLE( Z ) ) + ABS( DIMAG( Z ) )
                    231: *     ..
                    232: *     .. Executable Statements ..
                    233: *
                    234: *     Test the input parameters.
                    235: *
                    236:       INFO = 0
                    237:       UPPER = LSAME( UPLO, 'U' )
                    238:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    239:          INFO = -1
                    240:       ELSE IF( N.LT.0 ) THEN
                    241:          INFO = -2
                    242:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    243:          INFO = -4
                    244:       END IF
                    245:       IF( INFO.NE.0 ) THEN
                    246:          CALL XERBLA( 'ZSYTF2', -INFO )
                    247:          RETURN
                    248:       END IF
                    249: *
                    250: *     Initialize ALPHA for use in choosing pivot block size.
                    251: *
                    252:       ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
                    253: *
                    254:       IF( UPPER ) THEN
                    255: *
1.8       bertrand  256: *        Factorize A as U*D*U**T using the upper triangle of A
1.1       bertrand  257: *
                    258: *        K is the main loop index, decreasing from N to 1 in steps of
                    259: *        1 or 2
                    260: *
                    261:          K = N
                    262:    10    CONTINUE
                    263: *
                    264: *        If K < 1, exit from loop
                    265: *
                    266:          IF( K.LT.1 )
                    267:      $      GO TO 70
                    268:          KSTEP = 1
                    269: *
                    270: *        Determine rows and columns to be interchanged and whether
                    271: *        a 1-by-1 or 2-by-2 pivot block will be used
                    272: *
                    273:          ABSAKK = CABS1( A( K, K ) )
                    274: *
                    275: *        IMAX is the row-index of the largest off-diagonal element in
                    276: *        column K, and COLMAX is its absolute value
                    277: *
                    278:          IF( K.GT.1 ) THEN
                    279:             IMAX = IZAMAX( K-1, A( 1, K ), 1 )
                    280:             COLMAX = CABS1( A( IMAX, K ) )
                    281:          ELSE
                    282:             COLMAX = ZERO
                    283:          END IF
                    284: *
                    285:          IF( MAX( ABSAKK, COLMAX ).EQ.ZERO .OR. DISNAN(ABSAKK) ) THEN
                    286: *
1.8       bertrand  287: *           Column K is zero or NaN: set INFO and continue
1.1       bertrand  288: *
                    289:             IF( INFO.EQ.0 )
                    290:      $         INFO = K
                    291:             KP = K
                    292:          ELSE
                    293:             IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
                    294: *
                    295: *              no interchange, use 1-by-1 pivot block
                    296: *
                    297:                KP = K
                    298:             ELSE
                    299: *
                    300: *              JMAX is the column-index of the largest off-diagonal
                    301: *              element in row IMAX, and ROWMAX is its absolute value
                    302: *
                    303:                JMAX = IMAX + IZAMAX( K-IMAX, A( IMAX, IMAX+1 ), LDA )
                    304:                ROWMAX = CABS1( A( IMAX, JMAX ) )
                    305:                IF( IMAX.GT.1 ) THEN
                    306:                   JMAX = IZAMAX( IMAX-1, A( 1, IMAX ), 1 )
                    307:                   ROWMAX = MAX( ROWMAX, CABS1( A( JMAX, IMAX ) ) )
                    308:                END IF
                    309: *
                    310:                IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
                    311: *
                    312: *                 no interchange, use 1-by-1 pivot block
                    313: *
                    314:                   KP = K
                    315:                ELSE IF( CABS1( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
                    316: *
                    317: *                 interchange rows and columns K and IMAX, use 1-by-1
                    318: *                 pivot block
                    319: *
                    320:                   KP = IMAX
                    321:                ELSE
                    322: *
                    323: *                 interchange rows and columns K-1 and IMAX, use 2-by-2
                    324: *                 pivot block
                    325: *
                    326:                   KP = IMAX
                    327:                   KSTEP = 2
                    328:                END IF
                    329:             END IF
                    330: *
                    331:             KK = K - KSTEP + 1
                    332:             IF( KP.NE.KK ) THEN
                    333: *
                    334: *              Interchange rows and columns KK and KP in the leading
                    335: *              submatrix A(1:k,1:k)
                    336: *
                    337:                CALL ZSWAP( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
                    338:                CALL ZSWAP( KK-KP-1, A( KP+1, KK ), 1, A( KP, KP+1 ),
                    339:      $                     LDA )
                    340:                T = A( KK, KK )
                    341:                A( KK, KK ) = A( KP, KP )
                    342:                A( KP, KP ) = T
                    343:                IF( KSTEP.EQ.2 ) THEN
                    344:                   T = A( K-1, K )
                    345:                   A( K-1, K ) = A( KP, K )
                    346:                   A( KP, K ) = T
                    347:                END IF
                    348:             END IF
                    349: *
                    350: *           Update the leading submatrix
                    351: *
                    352:             IF( KSTEP.EQ.1 ) THEN
                    353: *
                    354: *              1-by-1 pivot block D(k): column k now holds
                    355: *
                    356: *              W(k) = U(k)*D(k)
                    357: *
                    358: *              where U(k) is the k-th column of U
                    359: *
                    360: *              Perform a rank-1 update of A(1:k-1,1:k-1) as
                    361: *
1.8       bertrand  362: *              A := A - U(k)*D(k)*U(k)**T = A - W(k)*1/D(k)*W(k)**T
1.1       bertrand  363: *
                    364:                R1 = CONE / A( K, K )
                    365:                CALL ZSYR( UPLO, K-1, -R1, A( 1, K ), 1, A, LDA )
                    366: *
                    367: *              Store U(k) in column k
                    368: *
                    369:                CALL ZSCAL( K-1, R1, A( 1, K ), 1 )
                    370:             ELSE
                    371: *
                    372: *              2-by-2 pivot block D(k): columns k and k-1 now hold
                    373: *
                    374: *              ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
                    375: *
                    376: *              where U(k) and U(k-1) are the k-th and (k-1)-th columns
                    377: *              of U
                    378: *
                    379: *              Perform a rank-2 update of A(1:k-2,1:k-2) as
                    380: *
1.8       bertrand  381: *              A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
                    382: *                 = A - ( W(k-1) W(k) )*inv(D(k))*( W(k-1) W(k) )**T
1.1       bertrand  383: *
                    384:                IF( K.GT.2 ) THEN
                    385: *
                    386:                   D12 = A( K-1, K )
                    387:                   D22 = A( K-1, K-1 ) / D12
                    388:                   D11 = A( K, K ) / D12
                    389:                   T = CONE / ( D11*D22-CONE )
                    390:                   D12 = T / D12
                    391: *
                    392:                   DO 30 J = K - 2, 1, -1
                    393:                      WKM1 = D12*( D11*A( J, K-1 )-A( J, K ) )
                    394:                      WK = D12*( D22*A( J, K )-A( J, K-1 ) )
                    395:                      DO 20 I = J, 1, -1
                    396:                         A( I, J ) = A( I, J ) - A( I, K )*WK -
                    397:      $                              A( I, K-1 )*WKM1
                    398:    20                CONTINUE
                    399:                      A( J, K ) = WK
                    400:                      A( J, K-1 ) = WKM1
                    401:    30             CONTINUE
                    402: *
                    403:                END IF
                    404: *
                    405:             END IF
                    406:          END IF
                    407: *
                    408: *        Store details of the interchanges in IPIV
                    409: *
                    410:          IF( KSTEP.EQ.1 ) THEN
                    411:             IPIV( K ) = KP
                    412:          ELSE
                    413:             IPIV( K ) = -KP
                    414:             IPIV( K-1 ) = -KP
                    415:          END IF
                    416: *
                    417: *        Decrease K and return to the start of the main loop
                    418: *
                    419:          K = K - KSTEP
                    420:          GO TO 10
                    421: *
                    422:       ELSE
                    423: *
1.8       bertrand  424: *        Factorize A as L*D*L**T using the lower triangle of A
1.1       bertrand  425: *
                    426: *        K is the main loop index, increasing from 1 to N in steps of
                    427: *        1 or 2
                    428: *
                    429:          K = 1
                    430:    40    CONTINUE
                    431: *
                    432: *        If K > N, exit from loop
                    433: *
                    434:          IF( K.GT.N )
                    435:      $      GO TO 70
                    436:          KSTEP = 1
                    437: *
                    438: *        Determine rows and columns to be interchanged and whether
                    439: *        a 1-by-1 or 2-by-2 pivot block will be used
                    440: *
                    441:          ABSAKK = CABS1( A( K, K ) )
                    442: *
                    443: *        IMAX is the row-index of the largest off-diagonal element in
                    444: *        column K, and COLMAX is its absolute value
                    445: *
                    446:          IF( K.LT.N ) THEN
                    447:             IMAX = K + IZAMAX( N-K, A( K+1, K ), 1 )
                    448:             COLMAX = CABS1( A( IMAX, K ) )
                    449:          ELSE
                    450:             COLMAX = ZERO
                    451:          END IF
                    452: *
                    453:          IF( MAX( ABSAKK, COLMAX ).EQ.ZERO .OR. DISNAN(ABSAKK) ) THEN
                    454: *
1.8       bertrand  455: *           Column K is zero or NaN: set INFO and continue
1.1       bertrand  456: *
                    457:             IF( INFO.EQ.0 )
                    458:      $         INFO = K
                    459:             KP = K
                    460:          ELSE
                    461:             IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
                    462: *
                    463: *              no interchange, use 1-by-1 pivot block
                    464: *
                    465:                KP = K
                    466:             ELSE
                    467: *
                    468: *              JMAX is the column-index of the largest off-diagonal
                    469: *              element in row IMAX, and ROWMAX is its absolute value
                    470: *
                    471:                JMAX = K - 1 + IZAMAX( IMAX-K, A( IMAX, K ), LDA )
                    472:                ROWMAX = CABS1( A( IMAX, JMAX ) )
                    473:                IF( IMAX.LT.N ) THEN
                    474:                   JMAX = IMAX + IZAMAX( N-IMAX, A( IMAX+1, IMAX ), 1 )
                    475:                   ROWMAX = MAX( ROWMAX, CABS1( A( JMAX, IMAX ) ) )
                    476:                END IF
                    477: *
                    478:                IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
                    479: *
                    480: *                 no interchange, use 1-by-1 pivot block
                    481: *
                    482:                   KP = K
                    483:                ELSE IF( CABS1( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
                    484: *
                    485: *                 interchange rows and columns K and IMAX, use 1-by-1
                    486: *                 pivot block
                    487: *
                    488:                   KP = IMAX
                    489:                ELSE
                    490: *
                    491: *                 interchange rows and columns K+1 and IMAX, use 2-by-2
                    492: *                 pivot block
                    493: *
                    494:                   KP = IMAX
                    495:                   KSTEP = 2
                    496:                END IF
                    497:             END IF
                    498: *
                    499:             KK = K + KSTEP - 1
                    500:             IF( KP.NE.KK ) THEN
                    501: *
                    502: *              Interchange rows and columns KK and KP in the trailing
                    503: *              submatrix A(k:n,k:n)
                    504: *
                    505:                IF( KP.LT.N )
                    506:      $            CALL ZSWAP( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
                    507:                CALL ZSWAP( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
                    508:      $                     LDA )
                    509:                T = A( KK, KK )
                    510:                A( KK, KK ) = A( KP, KP )
                    511:                A( KP, KP ) = T
                    512:                IF( KSTEP.EQ.2 ) THEN
                    513:                   T = A( K+1, K )
                    514:                   A( K+1, K ) = A( KP, K )
                    515:                   A( KP, K ) = T
                    516:                END IF
                    517:             END IF
                    518: *
                    519: *           Update the trailing submatrix
                    520: *
                    521:             IF( KSTEP.EQ.1 ) THEN
                    522: *
                    523: *              1-by-1 pivot block D(k): column k now holds
                    524: *
                    525: *              W(k) = L(k)*D(k)
                    526: *
                    527: *              where L(k) is the k-th column of L
                    528: *
                    529:                IF( K.LT.N ) THEN
                    530: *
                    531: *                 Perform a rank-1 update of A(k+1:n,k+1:n) as
                    532: *
1.8       bertrand  533: *                 A := A - L(k)*D(k)*L(k)**T = A - W(k)*(1/D(k))*W(k)**T
1.1       bertrand  534: *
                    535:                   R1 = CONE / A( K, K )
                    536:                   CALL ZSYR( UPLO, N-K, -R1, A( K+1, K ), 1,
                    537:      $                       A( K+1, K+1 ), LDA )
                    538: *
                    539: *                 Store L(k) in column K
                    540: *
                    541:                   CALL ZSCAL( N-K, R1, A( K+1, K ), 1 )
                    542:                END IF
                    543:             ELSE
                    544: *
                    545: *              2-by-2 pivot block D(k)
                    546: *
                    547:                IF( K.LT.N-1 ) THEN
                    548: *
                    549: *                 Perform a rank-2 update of A(k+2:n,k+2:n) as
                    550: *
1.8       bertrand  551: *                 A := A - ( L(k) L(k+1) )*D(k)*( L(k) L(k+1) )**T
                    552: *                    = A - ( W(k) W(k+1) )*inv(D(k))*( W(k) W(k+1) )**T
1.1       bertrand  553: *
                    554: *                 where L(k) and L(k+1) are the k-th and (k+1)-th
                    555: *                 columns of L
                    556: *
                    557:                   D21 = A( K+1, K )
                    558:                   D11 = A( K+1, K+1 ) / D21
                    559:                   D22 = A( K, K ) / D21
                    560:                   T = CONE / ( D11*D22-CONE )
                    561:                   D21 = T / D21
                    562: *
                    563:                   DO 60 J = K + 2, N
                    564:                      WK = D21*( D11*A( J, K )-A( J, K+1 ) )
                    565:                      WKP1 = D21*( D22*A( J, K+1 )-A( J, K ) )
                    566:                      DO 50 I = J, N
                    567:                         A( I, J ) = A( I, J ) - A( I, K )*WK -
                    568:      $                              A( I, K+1 )*WKP1
                    569:    50                CONTINUE
                    570:                      A( J, K ) = WK
                    571:                      A( J, K+1 ) = WKP1
                    572:    60             CONTINUE
                    573:                END IF
                    574:             END IF
                    575:          END IF
                    576: *
                    577: *        Store details of the interchanges in IPIV
                    578: *
                    579:          IF( KSTEP.EQ.1 ) THEN
                    580:             IPIV( K ) = KP
                    581:          ELSE
                    582:             IPIV( K ) = -KP
                    583:             IPIV( K+1 ) = -KP
                    584:          END IF
                    585: *
                    586: *        Increase K and return to the start of the main loop
                    587: *
                    588:          K = K + KSTEP
                    589:          GO TO 40
                    590: *
                    591:       END IF
                    592: *
                    593:    70 CONTINUE
                    594:       RETURN
                    595: *
                    596: *     End of ZSYTF2
                    597: *
                    598:       END

CVSweb interface <joel.bertrand@systella.fr>