Annotation of rpl/lapack/lapack/dsytf2.f, revision 1.12

1.12    ! bertrand    1: *> \brief \b DSYTF2 computes the factorization of a real symmetric indefinite matrix, using the diagonal pivoting method (unblocked algorithm).
1.9       bertrand    2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
                      5: * Online html documentation available at 
                      6: *            http://www.netlib.org/lapack/explore-html/ 
                      7: *
                      8: *> \htmlonly
                      9: *> Download DSYTF2 + dependencies 
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dsytf2.f"> 
                     11: *> [TGZ]</a> 
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dsytf2.f"> 
                     13: *> [ZIP]</a> 
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dsytf2.f"> 
                     15: *> [TXT]</a>
                     16: *> \endhtmlonly 
                     17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE DSYTF2( 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: *       DOUBLE PRECISION   A( LDA, * )
                     30: *       ..
                     31: *  
                     32: *
                     33: *> \par Purpose:
                     34: *  =============
                     35: *>
                     36: *> \verbatim
                     37: *>
                     38: *> DSYTF2 computes the factorization of a real symmetric matrix A using
                     39: *> 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 DOUBLE PRECISION 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: *
1.12    ! bertrand  121: *> \date September 2012
1.9       bertrand  122: *
                    123: *> \ingroup doubleSYcomputational
                    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.204 and l.372
                    174: *>         IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
                    175: *>    by
                    176: *>         IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. DISNAN(ABSAKK) ) THEN
                    177: *>
                    178: *>  01-01-96 - Based on modifications by
                    179: *>    J. Lewis, Boeing Computer Services Company
                    180: *>    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
                    181: *>  1-96 - Based on modifications by J. Lewis, Boeing Computer Services
                    182: *>         Company
                    183: *> \endverbatim
                    184: *
                    185: *  =====================================================================
1.1       bertrand  186:       SUBROUTINE DSYTF2( UPLO, N, A, LDA, IPIV, INFO )
                    187: *
1.12    ! bertrand  188: *  -- LAPACK computational routine (version 3.4.2) --
1.1       bertrand  189: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    190: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.12    ! bertrand  191: *     September 2012
1.1       bertrand  192: *
                    193: *     .. Scalar Arguments ..
                    194:       CHARACTER          UPLO
                    195:       INTEGER            INFO, LDA, N
                    196: *     ..
                    197: *     .. Array Arguments ..
                    198:       INTEGER            IPIV( * )
                    199:       DOUBLE PRECISION   A( LDA, * )
                    200: *     ..
                    201: *
                    202: *  =====================================================================
                    203: *
                    204: *     .. Parameters ..
                    205:       DOUBLE PRECISION   ZERO, ONE
                    206:       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0 )
                    207:       DOUBLE PRECISION   EIGHT, SEVTEN
                    208:       PARAMETER          ( EIGHT = 8.0D+0, SEVTEN = 17.0D+0 )
                    209: *     ..
                    210: *     .. Local Scalars ..
                    211:       LOGICAL            UPPER
                    212:       INTEGER            I, IMAX, J, JMAX, K, KK, KP, KSTEP
                    213:       DOUBLE PRECISION   ABSAKK, ALPHA, COLMAX, D11, D12, D21, D22, R1,
                    214:      $                   ROWMAX, T, WK, WKM1, WKP1
                    215: *     ..
                    216: *     .. External Functions ..
                    217:       LOGICAL            LSAME, DISNAN
                    218:       INTEGER            IDAMAX
                    219:       EXTERNAL           LSAME, IDAMAX, DISNAN
                    220: *     ..
                    221: *     .. External Subroutines ..
                    222:       EXTERNAL           DSCAL, DSWAP, DSYR, XERBLA
                    223: *     ..
                    224: *     .. Intrinsic Functions ..
                    225:       INTRINSIC          ABS, MAX, SQRT
                    226: *     ..
                    227: *     .. Executable Statements ..
                    228: *
                    229: *     Test the input parameters.
                    230: *
                    231:       INFO = 0
                    232:       UPPER = LSAME( UPLO, 'U' )
                    233:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    234:          INFO = -1
                    235:       ELSE IF( N.LT.0 ) THEN
                    236:          INFO = -2
                    237:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    238:          INFO = -4
                    239:       END IF
                    240:       IF( INFO.NE.0 ) THEN
                    241:          CALL XERBLA( 'DSYTF2', -INFO )
                    242:          RETURN
                    243:       END IF
                    244: *
                    245: *     Initialize ALPHA for use in choosing pivot block size.
                    246: *
                    247:       ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
                    248: *
                    249:       IF( UPPER ) THEN
                    250: *
1.8       bertrand  251: *        Factorize A as U*D*U**T using the upper triangle of A
1.1       bertrand  252: *
                    253: *        K is the main loop index, decreasing from N to 1 in steps of
                    254: *        1 or 2
                    255: *
                    256:          K = N
                    257:    10    CONTINUE
                    258: *
                    259: *        If K < 1, exit from loop
                    260: *
                    261:          IF( K.LT.1 )
                    262:      $      GO TO 70
                    263:          KSTEP = 1
                    264: *
                    265: *        Determine rows and columns to be interchanged and whether
                    266: *        a 1-by-1 or 2-by-2 pivot block will be used
                    267: *
                    268:          ABSAKK = ABS( A( K, K ) )
                    269: *
                    270: *        IMAX is the row-index of the largest off-diagonal element in
                    271: *        column K, and COLMAX is its absolute value
                    272: *
                    273:          IF( K.GT.1 ) THEN
                    274:             IMAX = IDAMAX( K-1, A( 1, K ), 1 )
                    275:             COLMAX = ABS( A( IMAX, K ) )
                    276:          ELSE
                    277:             COLMAX = ZERO
                    278:          END IF
                    279: *
                    280:          IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. DISNAN(ABSAKK) ) THEN
                    281: *
                    282: *           Column K is zero or contains a NaN: set INFO and continue
                    283: *
                    284:             IF( INFO.EQ.0 )
                    285:      $         INFO = K
                    286:             KP = K
                    287:          ELSE
                    288:             IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
                    289: *
                    290: *              no interchange, use 1-by-1 pivot block
                    291: *
                    292:                KP = K
                    293:             ELSE
                    294: *
                    295: *              JMAX is the column-index of the largest off-diagonal
                    296: *              element in row IMAX, and ROWMAX is its absolute value
                    297: *
                    298:                JMAX = IMAX + IDAMAX( K-IMAX, A( IMAX, IMAX+1 ), LDA )
                    299:                ROWMAX = ABS( A( IMAX, JMAX ) )
                    300:                IF( IMAX.GT.1 ) THEN
                    301:                   JMAX = IDAMAX( IMAX-1, A( 1, IMAX ), 1 )
                    302:                   ROWMAX = MAX( ROWMAX, ABS( A( JMAX, IMAX ) ) )
                    303:                END IF
                    304: *
                    305:                IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
                    306: *
                    307: *                 no interchange, use 1-by-1 pivot block
                    308: *
                    309:                   KP = K
                    310:                ELSE IF( ABS( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
                    311: *
                    312: *                 interchange rows and columns K and IMAX, use 1-by-1
                    313: *                 pivot block
                    314: *
                    315:                   KP = IMAX
                    316:                ELSE
                    317: *
                    318: *                 interchange rows and columns K-1 and IMAX, use 2-by-2
                    319: *                 pivot block
                    320: *
                    321:                   KP = IMAX
                    322:                   KSTEP = 2
                    323:                END IF
                    324:             END IF
                    325: *
                    326:             KK = K - KSTEP + 1
                    327:             IF( KP.NE.KK ) THEN
                    328: *
                    329: *              Interchange rows and columns KK and KP in the leading
                    330: *              submatrix A(1:k,1:k)
                    331: *
                    332:                CALL DSWAP( KP-1, A( 1, KK ), 1, A( 1, KP ), 1 )
                    333:                CALL DSWAP( KK-KP-1, A( KP+1, KK ), 1, A( KP, KP+1 ),
                    334:      $                     LDA )
                    335:                T = A( KK, KK )
                    336:                A( KK, KK ) = A( KP, KP )
                    337:                A( KP, KP ) = T
                    338:                IF( KSTEP.EQ.2 ) THEN
                    339:                   T = A( K-1, K )
                    340:                   A( K-1, K ) = A( KP, K )
                    341:                   A( KP, K ) = T
                    342:                END IF
                    343:             END IF
                    344: *
                    345: *           Update the leading submatrix
                    346: *
                    347:             IF( KSTEP.EQ.1 ) THEN
                    348: *
                    349: *              1-by-1 pivot block D(k): column k now holds
                    350: *
                    351: *              W(k) = U(k)*D(k)
                    352: *
                    353: *              where U(k) is the k-th column of U
                    354: *
                    355: *              Perform a rank-1 update of A(1:k-1,1:k-1) as
                    356: *
1.8       bertrand  357: *              A := A - U(k)*D(k)*U(k)**T = A - W(k)*1/D(k)*W(k)**T
1.1       bertrand  358: *
                    359:                R1 = ONE / A( K, K )
                    360:                CALL DSYR( UPLO, K-1, -R1, A( 1, K ), 1, A, LDA )
                    361: *
                    362: *              Store U(k) in column k
                    363: *
                    364:                CALL DSCAL( K-1, R1, A( 1, K ), 1 )
                    365:             ELSE
                    366: *
                    367: *              2-by-2 pivot block D(k): columns k and k-1 now hold
                    368: *
                    369: *              ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
                    370: *
                    371: *              where U(k) and U(k-1) are the k-th and (k-1)-th columns
                    372: *              of U
                    373: *
                    374: *              Perform a rank-2 update of A(1:k-2,1:k-2) as
                    375: *
1.8       bertrand  376: *              A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )**T
                    377: *                 = A - ( W(k-1) W(k) )*inv(D(k))*( W(k-1) W(k) )**T
1.1       bertrand  378: *
                    379:                IF( K.GT.2 ) THEN
                    380: *
                    381:                   D12 = A( K-1, K )
                    382:                   D22 = A( K-1, K-1 ) / D12
                    383:                   D11 = A( K, K ) / D12
                    384:                   T = ONE / ( D11*D22-ONE )
                    385:                   D12 = T / D12
                    386: *
                    387:                   DO 30 J = K - 2, 1, -1
                    388:                      WKM1 = D12*( D11*A( J, K-1 )-A( J, K ) )
                    389:                      WK = D12*( D22*A( J, K )-A( J, K-1 ) )
                    390:                      DO 20 I = J, 1, -1
                    391:                         A( I, J ) = A( I, J ) - A( I, K )*WK -
                    392:      $                              A( I, K-1 )*WKM1
                    393:    20                CONTINUE
                    394:                      A( J, K ) = WK
                    395:                      A( J, K-1 ) = WKM1
                    396:    30             CONTINUE
                    397: *
                    398:                END IF
                    399: *
                    400:             END IF
                    401:          END IF
                    402: *
                    403: *        Store details of the interchanges in IPIV
                    404: *
                    405:          IF( KSTEP.EQ.1 ) THEN
                    406:             IPIV( K ) = KP
                    407:          ELSE
                    408:             IPIV( K ) = -KP
                    409:             IPIV( K-1 ) = -KP
                    410:          END IF
                    411: *
                    412: *        Decrease K and return to the start of the main loop
                    413: *
                    414:          K = K - KSTEP
                    415:          GO TO 10
                    416: *
                    417:       ELSE
                    418: *
1.8       bertrand  419: *        Factorize A as L*D*L**T using the lower triangle of A
1.1       bertrand  420: *
                    421: *        K is the main loop index, increasing from 1 to N in steps of
                    422: *        1 or 2
                    423: *
                    424:          K = 1
                    425:    40    CONTINUE
                    426: *
                    427: *        If K > N, exit from loop
                    428: *
                    429:          IF( K.GT.N )
                    430:      $      GO TO 70
                    431:          KSTEP = 1
                    432: *
                    433: *        Determine rows and columns to be interchanged and whether
                    434: *        a 1-by-1 or 2-by-2 pivot block will be used
                    435: *
                    436:          ABSAKK = ABS( A( K, K ) )
                    437: *
                    438: *        IMAX is the row-index of the largest off-diagonal element in
                    439: *        column K, and COLMAX is its absolute value
                    440: *
                    441:          IF( K.LT.N ) THEN
                    442:             IMAX = K + IDAMAX( N-K, A( K+1, K ), 1 )
                    443:             COLMAX = ABS( A( IMAX, K ) )
                    444:          ELSE
                    445:             COLMAX = ZERO
                    446:          END IF
                    447: *
                    448:          IF( (MAX( ABSAKK, COLMAX ).EQ.ZERO) .OR. DISNAN(ABSAKK) ) THEN
                    449: *
                    450: *           Column K is zero or contains a NaN: set INFO and continue
                    451: *
                    452:             IF( INFO.EQ.0 )
                    453:      $         INFO = K
                    454:             KP = K
                    455:          ELSE
                    456:             IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
                    457: *
                    458: *              no interchange, use 1-by-1 pivot block
                    459: *
                    460:                KP = K
                    461:             ELSE
                    462: *
                    463: *              JMAX is the column-index of the largest off-diagonal
                    464: *              element in row IMAX, and ROWMAX is its absolute value
                    465: *
                    466:                JMAX = K - 1 + IDAMAX( IMAX-K, A( IMAX, K ), LDA )
                    467:                ROWMAX = ABS( A( IMAX, JMAX ) )
                    468:                IF( IMAX.LT.N ) THEN
                    469:                   JMAX = IMAX + IDAMAX( N-IMAX, A( IMAX+1, IMAX ), 1 )
                    470:                   ROWMAX = MAX( ROWMAX, ABS( A( JMAX, IMAX ) ) )
                    471:                END IF
                    472: *
                    473:                IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
                    474: *
                    475: *                 no interchange, use 1-by-1 pivot block
                    476: *
                    477:                   KP = K
                    478:                ELSE IF( ABS( A( IMAX, IMAX ) ).GE.ALPHA*ROWMAX ) THEN
                    479: *
                    480: *                 interchange rows and columns K and IMAX, use 1-by-1
                    481: *                 pivot block
                    482: *
                    483:                   KP = IMAX
                    484:                ELSE
                    485: *
                    486: *                 interchange rows and columns K+1 and IMAX, use 2-by-2
                    487: *                 pivot block
                    488: *
                    489:                   KP = IMAX
                    490:                   KSTEP = 2
                    491:                END IF
                    492:             END IF
                    493: *
                    494:             KK = K + KSTEP - 1
                    495:             IF( KP.NE.KK ) THEN
                    496: *
                    497: *              Interchange rows and columns KK and KP in the trailing
                    498: *              submatrix A(k:n,k:n)
                    499: *
                    500:                IF( KP.LT.N )
                    501:      $            CALL DSWAP( N-KP, A( KP+1, KK ), 1, A( KP+1, KP ), 1 )
                    502:                CALL DSWAP( KP-KK-1, A( KK+1, KK ), 1, A( KP, KK+1 ),
                    503:      $                     LDA )
                    504:                T = A( KK, KK )
                    505:                A( KK, KK ) = A( KP, KP )
                    506:                A( KP, KP ) = T
                    507:                IF( KSTEP.EQ.2 ) THEN
                    508:                   T = A( K+1, K )
                    509:                   A( K+1, K ) = A( KP, K )
                    510:                   A( KP, K ) = T
                    511:                END IF
                    512:             END IF
                    513: *
                    514: *           Update the trailing submatrix
                    515: *
                    516:             IF( KSTEP.EQ.1 ) THEN
                    517: *
                    518: *              1-by-1 pivot block D(k): column k now holds
                    519: *
                    520: *              W(k) = L(k)*D(k)
                    521: *
                    522: *              where L(k) is the k-th column of L
                    523: *
                    524:                IF( K.LT.N ) THEN
                    525: *
                    526: *                 Perform a rank-1 update of A(k+1:n,k+1:n) as
                    527: *
1.8       bertrand  528: *                 A := A - L(k)*D(k)*L(k)**T = A - W(k)*(1/D(k))*W(k)**T
1.1       bertrand  529: *
                    530:                   D11 = ONE / A( K, K )
                    531:                   CALL DSYR( UPLO, N-K, -D11, A( K+1, K ), 1,
                    532:      $                       A( K+1, K+1 ), LDA )
                    533: *
                    534: *                 Store L(k) in column K
                    535: *
                    536:                   CALL DSCAL( N-K, D11, A( K+1, K ), 1 )
                    537:                END IF
                    538:             ELSE
                    539: *
                    540: *              2-by-2 pivot block D(k)
                    541: *
                    542:                IF( K.LT.N-1 ) THEN
                    543: *
                    544: *                 Perform a rank-2 update of A(k+2:n,k+2:n) as
                    545: *
1.8       bertrand  546: *                 A := A - ( (A(k) A(k+1))*D(k)**(-1) ) * (A(k) A(k+1))**T
1.1       bertrand  547: *
                    548: *                 where L(k) and L(k+1) are the k-th and (k+1)-th
                    549: *                 columns of L
                    550: *
                    551:                   D21 = A( K+1, K )
                    552:                   D11 = A( K+1, K+1 ) / D21
                    553:                   D22 = A( K, K ) / D21
                    554:                   T = ONE / ( D11*D22-ONE )
                    555:                   D21 = T / D21
                    556: *
                    557:                   DO 60 J = K + 2, N
                    558: *
                    559:                      WK = D21*( D11*A( J, K )-A( J, K+1 ) )
                    560:                      WKP1 = D21*( D22*A( J, K+1 )-A( J, K ) )
                    561: *
                    562:                      DO 50 I = J, N
                    563:                         A( I, J ) = A( I, J ) - A( I, K )*WK -
                    564:      $                              A( I, K+1 )*WKP1
                    565:    50                CONTINUE
                    566: *
                    567:                      A( J, K ) = WK
                    568:                      A( J, K+1 ) = WKP1
                    569: *
                    570:    60             CONTINUE
                    571:                END IF
                    572:             END IF
                    573:          END IF
                    574: *
                    575: *        Store details of the interchanges in IPIV
                    576: *
                    577:          IF( KSTEP.EQ.1 ) THEN
                    578:             IPIV( K ) = KP
                    579:          ELSE
                    580:             IPIV( K ) = -KP
                    581:             IPIV( K+1 ) = -KP
                    582:          END IF
                    583: *
                    584: *        Increase K and return to the start of the main loop
                    585: *
                    586:          K = K + KSTEP
                    587:          GO TO 40
                    588: *
                    589:       END IF
                    590: *
                    591:    70 CONTINUE
                    592: *
                    593:       RETURN
                    594: *
                    595: *     End of DSYTF2
                    596: *
                    597:       END

CVSweb interface <joel.bertrand@systella.fr>