LAPACK 3.3.0

chptrf.f

Go to the documentation of this file.
00001       SUBROUTINE CHPTRF( UPLO, N, AP, IPIV, INFO )
00002 *
00003 *  -- LAPACK routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            INFO, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       INTEGER            IPIV( * )
00014       COMPLEX            AP( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  CHPTRF computes the factorization of a complex Hermitian packed
00021 *  matrix A using the Bunch-Kaufman diagonal pivoting method:
00022 *
00023 *     A = U*D*U**H  or  A = L*D*L**H
00024 *
00025 *  where U (or L) is a product of permutation and unit upper (lower)
00026 *  triangular matrices, and D is Hermitian and block diagonal with
00027 *  1-by-1 and 2-by-2 diagonal blocks.
00028 *
00029 *  Arguments
00030 *  =========
00031 *
00032 *  UPLO    (input) CHARACTER*1
00033 *          = 'U':  Upper triangle of A is stored;
00034 *          = 'L':  Lower triangle of A is stored.
00035 *
00036 *  N       (input) INTEGER
00037 *          The order of the matrix A.  N >= 0.
00038 *
00039 *  AP      (input/output) COMPLEX array, dimension (N*(N+1)/2)
00040 *          On entry, the upper or lower triangle of the Hermitian matrix
00041 *          A, packed columnwise in a linear array.  The j-th column of A
00042 *          is stored in the array AP as follows:
00043 *          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00044 *          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
00045 *
00046 *          On exit, the block diagonal matrix D and the multipliers used
00047 *          to obtain the factor U or L, stored as a packed triangular
00048 *          matrix overwriting A (see below for further details).
00049 *
00050 *  IPIV    (output) INTEGER array, dimension (N)
00051 *          Details of the interchanges and the block structure of D.
00052 *          If IPIV(k) > 0, then rows and columns k and IPIV(k) were
00053 *          interchanged and D(k,k) is a 1-by-1 diagonal block.
00054 *          If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and
00055 *          columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k)
00056 *          is a 2-by-2 diagonal block.  If UPLO = 'L' and IPIV(k) =
00057 *          IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were
00058 *          interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block.
00059 *
00060 *  INFO    (output) INTEGER
00061 *          = 0: successful exit
00062 *          < 0: if INFO = -i, the i-th argument had an illegal value
00063 *          > 0: if INFO = i, D(i,i) is exactly zero.  The factorization
00064 *               has been completed, but the block diagonal matrix D is
00065 *               exactly singular, and division by zero will occur if it
00066 *               is used to solve a system of equations.
00067 *
00068 *  Further Details
00069 *  ===============
00070 *
00071 *  5-96 - Based on modifications by J. Lewis, Boeing Computer Services
00072 *         Company
00073 *
00074 *  If UPLO = 'U', then A = U*D*U', where
00075 *     U = P(n)*U(n)* ... *P(k)U(k)* ...,
00076 *  i.e., U is a product of terms P(k)*U(k), where k decreases from n to
00077 *  1 in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
00078 *  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
00079 *  defined by IPIV(k), and U(k) is a unit upper triangular matrix, such
00080 *  that if the diagonal block D(k) is of order s (s = 1 or 2), then
00081 *
00082 *             (   I    v    0   )   k-s
00083 *     U(k) =  (   0    I    0   )   s
00084 *             (   0    0    I   )   n-k
00085 *                k-s   s   n-k
00086 *
00087 *  If s = 1, D(k) overwrites A(k,k), and v overwrites A(1:k-1,k).
00088 *  If s = 2, the upper triangle of D(k) overwrites A(k-1,k-1), A(k-1,k),
00089 *  and A(k,k), and v overwrites A(1:k-2,k-1:k).
00090 *
00091 *  If UPLO = 'L', then A = L*D*L', where
00092 *     L = P(1)*L(1)* ... *P(k)*L(k)* ...,
00093 *  i.e., L is a product of terms P(k)*L(k), where k increases from 1 to
00094 *  n in steps of 1 or 2, and D is a block diagonal matrix with 1-by-1
00095 *  and 2-by-2 diagonal blocks D(k).  P(k) is a permutation matrix as
00096 *  defined by IPIV(k), and L(k) is a unit lower triangular matrix, such
00097 *  that if the diagonal block D(k) is of order s (s = 1 or 2), then
00098 *
00099 *             (   I    0     0   )  k-1
00100 *     L(k) =  (   0    I     0   )  s
00101 *             (   0    v     I   )  n-k-s+1
00102 *                k-1   s  n-k-s+1
00103 *
00104 *  If s = 1, D(k) overwrites A(k,k), and v overwrites A(k+1:n,k).
00105 *  If s = 2, the lower triangle of D(k) overwrites A(k,k), A(k+1,k),
00106 *  and A(k+1,k+1), and v overwrites A(k+2:n,k:k+1).
00107 *
00108 *  =====================================================================
00109 *
00110 *     .. Parameters ..
00111       REAL               ZERO, ONE
00112       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0 )
00113       REAL               EIGHT, SEVTEN
00114       PARAMETER          ( EIGHT = 8.0E+0, SEVTEN = 17.0E+0 )
00115 *     ..
00116 *     .. Local Scalars ..
00117       LOGICAL            UPPER
00118       INTEGER            I, IMAX, J, JMAX, K, KC, KK, KNC, KP, KPC,
00119      $                   KSTEP, KX, NPP
00120       REAL               ABSAKK, ALPHA, COLMAX, D, D11, D22, R1, ROWMAX,
00121      $                   TT
00122       COMPLEX            D12, D21, T, WK, WKM1, WKP1, ZDUM
00123 *     ..
00124 *     .. External Functions ..
00125       LOGICAL            LSAME
00126       INTEGER            ICAMAX
00127       REAL               SLAPY2
00128       EXTERNAL           LSAME, ICAMAX, SLAPY2
00129 *     ..
00130 *     .. External Subroutines ..
00131       EXTERNAL           CHPR, CSSCAL, CSWAP, XERBLA
00132 *     ..
00133 *     .. Intrinsic Functions ..
00134       INTRINSIC          ABS, AIMAG, CMPLX, CONJG, MAX, REAL, SQRT
00135 *     ..
00136 *     .. Statement Functions ..
00137       REAL               CABS1
00138 *     ..
00139 *     .. Statement Function definitions ..
00140       CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
00141 *     ..
00142 *     .. Executable Statements ..
00143 *
00144 *     Test the input parameters.
00145 *
00146       INFO = 0
00147       UPPER = LSAME( UPLO, 'U' )
00148       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00149          INFO = -1
00150       ELSE IF( N.LT.0 ) THEN
00151          INFO = -2
00152       END IF
00153       IF( INFO.NE.0 ) THEN
00154          CALL XERBLA( 'CHPTRF', -INFO )
00155          RETURN
00156       END IF
00157 *
00158 *     Initialize ALPHA for use in choosing pivot block size.
00159 *
00160       ALPHA = ( ONE+SQRT( SEVTEN ) ) / EIGHT
00161 *
00162       IF( UPPER ) THEN
00163 *
00164 *        Factorize A as U*D*U' using the upper triangle of A
00165 *
00166 *        K is the main loop index, decreasing from N to 1 in steps of
00167 *        1 or 2
00168 *
00169          K = N
00170          KC = ( N-1 )*N / 2 + 1
00171    10    CONTINUE
00172          KNC = KC
00173 *
00174 *        If K < 1, exit from loop
00175 *
00176          IF( K.LT.1 )
00177      $      GO TO 110
00178          KSTEP = 1
00179 *
00180 *        Determine rows and columns to be interchanged and whether
00181 *        a 1-by-1 or 2-by-2 pivot block will be used
00182 *
00183          ABSAKK = ABS( REAL( AP( KC+K-1 ) ) )
00184 *
00185 *        IMAX is the row-index of the largest off-diagonal element in
00186 *        column K, and COLMAX is its absolute value
00187 *
00188          IF( K.GT.1 ) THEN
00189             IMAX = ICAMAX( K-1, AP( KC ), 1 )
00190             COLMAX = CABS1( AP( KC+IMAX-1 ) )
00191          ELSE
00192             COLMAX = ZERO
00193          END IF
00194 *
00195          IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
00196 *
00197 *           Column K is zero: set INFO and continue
00198 *
00199             IF( INFO.EQ.0 )
00200      $         INFO = K
00201             KP = K
00202             AP( KC+K-1 ) = REAL( AP( KC+K-1 ) )
00203          ELSE
00204             IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
00205 *
00206 *              no interchange, use 1-by-1 pivot block
00207 *
00208                KP = K
00209             ELSE
00210 *
00211 *              JMAX is the column-index of the largest off-diagonal
00212 *              element in row IMAX, and ROWMAX is its absolute value
00213 *
00214                ROWMAX = ZERO
00215                JMAX = IMAX
00216                KX = IMAX*( IMAX+1 ) / 2 + IMAX
00217                DO 20 J = IMAX + 1, K
00218                   IF( CABS1( AP( KX ) ).GT.ROWMAX ) THEN
00219                      ROWMAX = CABS1( AP( KX ) )
00220                      JMAX = J
00221                   END IF
00222                   KX = KX + J
00223    20          CONTINUE
00224                KPC = ( IMAX-1 )*IMAX / 2 + 1
00225                IF( IMAX.GT.1 ) THEN
00226                   JMAX = ICAMAX( IMAX-1, AP( KPC ), 1 )
00227                   ROWMAX = MAX( ROWMAX, CABS1( AP( KPC+JMAX-1 ) ) )
00228                END IF
00229 *
00230                IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
00231 *
00232 *                 no interchange, use 1-by-1 pivot block
00233 *
00234                   KP = K
00235                ELSE IF( ABS( REAL( AP( KPC+IMAX-1 ) ) ).GE.ALPHA*
00236      $                  ROWMAX ) THEN
00237 *
00238 *                 interchange rows and columns K and IMAX, use 1-by-1
00239 *                 pivot block
00240 *
00241                   KP = IMAX
00242                ELSE
00243 *
00244 *                 interchange rows and columns K-1 and IMAX, use 2-by-2
00245 *                 pivot block
00246 *
00247                   KP = IMAX
00248                   KSTEP = 2
00249                END IF
00250             END IF
00251 *
00252             KK = K - KSTEP + 1
00253             IF( KSTEP.EQ.2 )
00254      $         KNC = KNC - K + 1
00255             IF( KP.NE.KK ) THEN
00256 *
00257 *              Interchange rows and columns KK and KP in the leading
00258 *              submatrix A(1:k,1:k)
00259 *
00260                CALL CSWAP( KP-1, AP( KNC ), 1, AP( KPC ), 1 )
00261                KX = KPC + KP - 1
00262                DO 30 J = KP + 1, KK - 1
00263                   KX = KX + J - 1
00264                   T = CONJG( AP( KNC+J-1 ) )
00265                   AP( KNC+J-1 ) = CONJG( AP( KX ) )
00266                   AP( KX ) = T
00267    30          CONTINUE
00268                AP( KX+KK-1 ) = CONJG( AP( KX+KK-1 ) )
00269                R1 = REAL( AP( KNC+KK-1 ) )
00270                AP( KNC+KK-1 ) = REAL( AP( KPC+KP-1 ) )
00271                AP( KPC+KP-1 ) = R1
00272                IF( KSTEP.EQ.2 ) THEN
00273                   AP( KC+K-1 ) = REAL( AP( KC+K-1 ) )
00274                   T = AP( KC+K-2 )
00275                   AP( KC+K-2 ) = AP( KC+KP-1 )
00276                   AP( KC+KP-1 ) = T
00277                END IF
00278             ELSE
00279                AP( KC+K-1 ) = REAL( AP( KC+K-1 ) )
00280                IF( KSTEP.EQ.2 )
00281      $            AP( KC-1 ) = REAL( AP( KC-1 ) )
00282             END IF
00283 *
00284 *           Update the leading submatrix
00285 *
00286             IF( KSTEP.EQ.1 ) THEN
00287 *
00288 *              1-by-1 pivot block D(k): column k now holds
00289 *
00290 *              W(k) = U(k)*D(k)
00291 *
00292 *              where U(k) is the k-th column of U
00293 *
00294 *              Perform a rank-1 update of A(1:k-1,1:k-1) as
00295 *
00296 *              A := A - U(k)*D(k)*U(k)' = A - W(k)*1/D(k)*W(k)'
00297 *
00298                R1 = ONE / REAL( AP( KC+K-1 ) )
00299                CALL CHPR( UPLO, K-1, -R1, AP( KC ), 1, AP )
00300 *
00301 *              Store U(k) in column k
00302 *
00303                CALL CSSCAL( K-1, R1, AP( KC ), 1 )
00304             ELSE
00305 *
00306 *              2-by-2 pivot block D(k): columns k and k-1 now hold
00307 *
00308 *              ( W(k-1) W(k) ) = ( U(k-1) U(k) )*D(k)
00309 *
00310 *              where U(k) and U(k-1) are the k-th and (k-1)-th columns
00311 *              of U
00312 *
00313 *              Perform a rank-2 update of A(1:k-2,1:k-2) as
00314 *
00315 *              A := A - ( U(k-1) U(k) )*D(k)*( U(k-1) U(k) )'
00316 *                 = A - ( W(k-1) W(k) )*inv(D(k))*( W(k-1) W(k) )'
00317 *
00318                IF( K.GT.2 ) THEN
00319 *
00320                   D = SLAPY2( REAL( AP( K-1+( K-1 )*K / 2 ) ),
00321      $                AIMAG( AP( K-1+( K-1 )*K / 2 ) ) )
00322                   D22 = REAL( AP( K-1+( K-2 )*( K-1 ) / 2 ) ) / D
00323                   D11 = REAL( AP( K+( K-1 )*K / 2 ) ) / D
00324                   TT = ONE / ( D11*D22-ONE )
00325                   D12 = AP( K-1+( K-1 )*K / 2 ) / D
00326                   D = TT / D
00327 *
00328                   DO 50 J = K - 2, 1, -1
00329                      WKM1 = D*( D11*AP( J+( K-2 )*( K-1 ) / 2 )-
00330      $                      CONJG( D12 )*AP( J+( K-1 )*K / 2 ) )
00331                      WK = D*( D22*AP( J+( K-1 )*K / 2 )-D12*
00332      $                    AP( J+( K-2 )*( K-1 ) / 2 ) )
00333                      DO 40 I = J, 1, -1
00334                         AP( I+( J-1 )*J / 2 ) = AP( I+( J-1 )*J / 2 ) -
00335      $                     AP( I+( K-1 )*K / 2 )*CONJG( WK ) -
00336      $                     AP( I+( K-2 )*( K-1 ) / 2 )*CONJG( WKM1 )
00337    40                CONTINUE
00338                      AP( J+( K-1 )*K / 2 ) = WK
00339                      AP( J+( K-2 )*( K-1 ) / 2 ) = WKM1
00340                      AP( J+( J-1 )*J / 2 ) = CMPLX( REAL( AP( J+( J-1 )*
     $                                       J / 2 ) ), 0.0E+0 )
00341    50             CONTINUE
00342 *
00343                END IF
00344 *
00345             END IF
00346          END IF
00347 *
00348 *        Store details of the interchanges in IPIV
00349 *
00350          IF( KSTEP.EQ.1 ) THEN
00351             IPIV( K ) = KP
00352          ELSE
00353             IPIV( K ) = -KP
00354             IPIV( K-1 ) = -KP
00355          END IF
00356 *
00357 *        Decrease K and return to the start of the main loop
00358 *
00359          K = K - KSTEP
00360          KC = KNC - K
00361          GO TO 10
00362 *
00363       ELSE
00364 *
00365 *        Factorize A as L*D*L' using the lower triangle of A
00366 *
00367 *        K is the main loop index, increasing from 1 to N in steps of
00368 *        1 or 2
00369 *
00370          K = 1
00371          KC = 1
00372          NPP = N*( N+1 ) / 2
00373    60    CONTINUE
00374          KNC = KC
00375 *
00376 *        If K > N, exit from loop
00377 *
00378          IF( K.GT.N )
00379      $      GO TO 110
00380          KSTEP = 1
00381 *
00382 *        Determine rows and columns to be interchanged and whether
00383 *        a 1-by-1 or 2-by-2 pivot block will be used
00384 *
00385          ABSAKK = ABS( REAL( AP( KC ) ) )
00386 *
00387 *        IMAX is the row-index of the largest off-diagonal element in
00388 *        column K, and COLMAX is its absolute value
00389 *
00390          IF( K.LT.N ) THEN
00391             IMAX = K + ICAMAX( N-K, AP( KC+1 ), 1 )
00392             COLMAX = CABS1( AP( KC+IMAX-K ) )
00393          ELSE
00394             COLMAX = ZERO
00395          END IF
00396 *
00397          IF( MAX( ABSAKK, COLMAX ).EQ.ZERO ) THEN
00398 *
00399 *           Column K is zero: set INFO and continue
00400 *
00401             IF( INFO.EQ.0 )
00402      $         INFO = K
00403             KP = K
00404             AP( KC ) = REAL( AP( KC ) )
00405          ELSE
00406             IF( ABSAKK.GE.ALPHA*COLMAX ) THEN
00407 *
00408 *              no interchange, use 1-by-1 pivot block
00409 *
00410                KP = K
00411             ELSE
00412 *
00413 *              JMAX is the column-index of the largest off-diagonal
00414 *              element in row IMAX, and ROWMAX is its absolute value
00415 *
00416                ROWMAX = ZERO
00417                KX = KC + IMAX - K
00418                DO 70 J = K, IMAX - 1
00419                   IF( CABS1( AP( KX ) ).GT.ROWMAX ) THEN
00420                      ROWMAX = CABS1( AP( KX ) )
00421                      JMAX = J
00422                   END IF
00423                   KX = KX + N - J
00424    70          CONTINUE
00425                KPC = NPP - ( N-IMAX+1 )*( N-IMAX+2 ) / 2 + 1
00426                IF( IMAX.LT.N ) THEN
00427                   JMAX = IMAX + ICAMAX( N-IMAX, AP( KPC+1 ), 1 )
00428                   ROWMAX = MAX( ROWMAX, CABS1( AP( KPC+JMAX-IMAX ) ) )
00429                END IF
00430 *
00431                IF( ABSAKK.GE.ALPHA*COLMAX*( COLMAX / ROWMAX ) ) THEN
00432 *
00433 *                 no interchange, use 1-by-1 pivot block
00434 *
00435                   KP = K
00436                ELSE IF( ABS( REAL( AP( KPC ) ) ).GE.ALPHA*ROWMAX ) THEN
00437 *
00438 *                 interchange rows and columns K and IMAX, use 1-by-1
00439 *                 pivot block
00440 *
00441                   KP = IMAX
00442                ELSE
00443 *
00444 *                 interchange rows and columns K+1 and IMAX, use 2-by-2
00445 *                 pivot block
00446 *
00447                   KP = IMAX
00448                   KSTEP = 2
00449                END IF
00450             END IF
00451 *
00452             KK = K + KSTEP - 1
00453             IF( KSTEP.EQ.2 )
00454      $         KNC = KNC + N - K + 1
00455             IF( KP.NE.KK ) THEN
00456 *
00457 *              Interchange rows and columns KK and KP in the trailing
00458 *              submatrix A(k:n,k:n)
00459 *
00460                IF( KP.LT.N )
00461      $            CALL CSWAP( N-KP, AP( KNC+KP-KK+1 ), 1, AP( KPC+1 ),
00462      $                        1 )
00463                KX = KNC + KP - KK
00464                DO 80 J = KK + 1, KP - 1
00465                   KX = KX + N - J + 1
00466                   T = CONJG( AP( KNC+J-KK ) )
00467                   AP( KNC+J-KK ) = CONJG( AP( KX ) )
00468                   AP( KX ) = T
00469    80          CONTINUE
00470                AP( KNC+KP-KK ) = CONJG( AP( KNC+KP-KK ) )
00471                R1 = REAL( AP( KNC ) )
00472                AP( KNC ) = REAL( AP( KPC ) )
00473                AP( KPC ) = R1
00474                IF( KSTEP.EQ.2 ) THEN
00475                   AP( KC ) = REAL( AP( KC ) )
00476                   T = AP( KC+1 )
00477                   AP( KC+1 ) = AP( KC+KP-K )
00478                   AP( KC+KP-K ) = T
00479                END IF
00480             ELSE
00481                AP( KC ) = REAL( AP( KC ) )
00482                IF( KSTEP.EQ.2 )
00483      $            AP( KNC ) = REAL( AP( KNC ) )
00484             END IF
00485 *
00486 *           Update the trailing submatrix
00487 *
00488             IF( KSTEP.EQ.1 ) THEN
00489 *
00490 *              1-by-1 pivot block D(k): column k now holds
00491 *
00492 *              W(k) = L(k)*D(k)
00493 *
00494 *              where L(k) is the k-th column of L
00495 *
00496                IF( K.LT.N ) THEN
00497 *
00498 *                 Perform a rank-1 update of A(k+1:n,k+1:n) as
00499 *
00500 *                 A := A - L(k)*D(k)*L(k)' = A - W(k)*(1/D(k))*W(k)'
00501 *
00502                   R1 = ONE / REAL( AP( KC ) )
00503                   CALL CHPR( UPLO, N-K, -R1, AP( KC+1 ), 1,
00504      $                       AP( KC+N-K+1 ) )
00505 *
00506 *                 Store L(k) in column K
00507 *
00508                   CALL CSSCAL( N-K, R1, AP( KC+1 ), 1 )
00509                END IF
00510             ELSE
00511 *
00512 *              2-by-2 pivot block D(k): columns K and K+1 now hold
00513 *
00514 *              ( W(k) W(k+1) ) = ( L(k) L(k+1) )*D(k)
00515 *
00516 *              where L(k) and L(k+1) are the k-th and (k+1)-th columns
00517 *              of L
00518 *
00519                IF( K.LT.N-1 ) THEN
00520 *
00521 *                 Perform a rank-2 update of A(k+2:n,k+2:n) as
00522 *
00523 *                 A := A - ( L(k) L(k+1) )*D(k)*( L(k) L(k+1) )'
00524 *                    = A - ( W(k) W(k+1) )*inv(D(k))*( W(k) W(k+1) )'
00525 *
00526 *                 where L(k) and L(k+1) are the k-th and (k+1)-th
00527 *                 columns of L
00528 *
00529                   D = SLAPY2( REAL( AP( K+1+( K-1 )*( 2*N-K ) / 2 ) ),
00530      $                AIMAG( AP( K+1+( K-1 )*( 2*N-K ) / 2 ) ) )
00531                   D11 = REAL( AP( K+1+K*( 2*N-K-1 ) / 2 ) ) / D
00532                   D22 = REAL( AP( K+( K-1 )*( 2*N-K ) / 2 ) ) / D
00533                   TT = ONE / ( D11*D22-ONE )
00534                   D21 = AP( K+1+( K-1 )*( 2*N-K ) / 2 ) / D
00535                   D = TT / D
00536 *
00537                   DO 100 J = K + 2, N
00538                      WK = D*( D11*AP( J+( K-1 )*( 2*N-K ) / 2 )-D21*
00539      $                    AP( J+K*( 2*N-K-1 ) / 2 ) )
00540                      WKP1 = D*( D22*AP( J+K*( 2*N-K-1 ) / 2 )-
00541      $                      CONJG( D21 )*AP( J+( K-1 )*( 2*N-K ) / 2 ) )
00542                      DO 90 I = J, N
00543                         AP( I+( J-1 )*( 2*N-J ) / 2 ) = AP( I+( J-1 )*
00544      $                     ( 2*N-J ) / 2 ) - AP( I+( K-1 )*( 2*N-K ) /
00545      $                     2 )*CONJG( WK ) - AP( I+K*( 2*N-K-1 ) / 2 )*
00546      $                     CONJG( WKP1 )
00547    90                CONTINUE
00548                      AP( J+( K-1 )*( 2*N-K ) / 2 ) = WK
00549                      AP( J+K*( 2*N-K-1 ) / 2 ) = WKP1
00550                      AP( J+( J-1 )*( 2*N-J ) / 2 )
00551      $                  = CMPLX( REAL( AP( J+( J-1 )*( 2*N-J ) / 2 ) ),
00552      $                  0.0E+0 )
00553   100             CONTINUE
00554                END IF
00555             END IF
00556          END IF
00557 *
00558 *        Store details of the interchanges in IPIV
00559 *
00560          IF( KSTEP.EQ.1 ) THEN
00561             IPIV( K ) = KP
00562          ELSE
00563             IPIV( K ) = -KP
00564             IPIV( K+1 ) = -KP
00565          END IF
00566 *
00567 *        Increase K and return to the start of the main loop
00568 *
00569          K = K + KSTEP
00570          KC = KNC + N - K + 2
00571          GO TO 60
00572 *
00573       END IF
00574 *
00575   110 CONTINUE
00576       RETURN
00577 *
00578 *     End of CHPTRF
00579 *
00580       END
00581 
 All Files Functions