LAPACK 3.3.1
Linear Algebra PACKage

cpbstf.f

Go to the documentation of this file.
00001       SUBROUTINE CPBSTF( UPLO, N, KD, AB, LDAB, 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, KD, LDAB, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       COMPLEX            AB( LDAB, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  CPBSTF computes a split Cholesky factorization of a complex
00020 *  Hermitian positive definite band matrix A.
00021 *
00022 *  This routine is designed to be used in conjunction with CHBGST.
00023 *
00024 *  The factorization has the form  A = S**H*S  where S is a band matrix
00025 *  of the same bandwidth as A and the following structure:
00026 *
00027 *    S = ( U    )
00028 *        ( M  L )
00029 *
00030 *  where U is upper triangular of order m = (n+kd)/2, and L is lower
00031 *  triangular of order n-m.
00032 *
00033 *  Arguments
00034 *  =========
00035 *
00036 *  UPLO    (input) CHARACTER*1
00037 *          = 'U':  Upper triangle of A is stored;
00038 *          = 'L':  Lower triangle of A is stored.
00039 *
00040 *  N       (input) INTEGER
00041 *          The order of the matrix A.  N >= 0.
00042 *
00043 *  KD      (input) INTEGER
00044 *          The number of superdiagonals of the matrix A if UPLO = 'U',
00045 *          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
00046 *
00047 *  AB      (input/output) COMPLEX array, dimension (LDAB,N)
00048 *          On entry, the upper or lower triangle of the Hermitian band
00049 *          matrix A, stored in the first kd+1 rows of the array.  The
00050 *          j-th column of A is stored in the j-th column of the array AB
00051 *          as follows:
00052 *          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
00053 *          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
00054 *
00055 *          On exit, if INFO = 0, the factor S from the split Cholesky
00056 *          factorization A = S**H*S. See Further Details.
00057 *
00058 *  LDAB    (input) INTEGER
00059 *          The leading dimension of the array AB.  LDAB >= KD+1.
00060 *
00061 *  INFO    (output) INTEGER
00062 *          = 0: successful exit
00063 *          < 0: if INFO = -i, the i-th argument had an illegal value
00064 *          > 0: if INFO = i, the factorization could not be completed,
00065 *               because the updated element a(i,i) was negative; the
00066 *               matrix A is not positive definite.
00067 *
00068 *  Further Details
00069 *  ===============
00070 *
00071 *  The band storage scheme is illustrated by the following example, when
00072 *  N = 7, KD = 2:
00073 *
00074 *  S = ( s11  s12  s13                     )
00075 *      (      s22  s23  s24                )
00076 *      (           s33  s34                )
00077 *      (                s44                )
00078 *      (           s53  s54  s55           )
00079 *      (                s64  s65  s66      )
00080 *      (                     s75  s76  s77 )
00081 *
00082 *  If UPLO = 'U', the array AB holds:
00083 *
00084 *  on entry:                          on exit:
00085 *
00086 *   *    *   a13  a24  a35  a46  a57   *    *   s13  s24  s53**H s64**H s75**H
00087 *   *   a12  a23  a34  a45  a56  a67   *   s12  s23  s34  s54**H s65**H s76**H
00088 *  a11  a22  a33  a44  a55  a66  a77  s11  s22  s33  s44  s55    s66    s77
00089 *
00090 *  If UPLO = 'L', the array AB holds:
00091 *
00092 *  on entry:                          on exit:
00093 *
00094 *  a11  a22  a33  a44  a55  a66  a77  s11    s22    s33    s44  s55  s66  s77
00095 *  a21  a32  a43  a54  a65  a76   *   s12**H s23**H s34**H s54  s65  s76   *
00096 *  a31  a42  a53  a64  a64   *    *   s13**H s24**H s53    s64  s75   *    *
00097 *
00098 *  Array elements marked * are not used by the routine; s12**H denotes
00099 *  conjg(s12); the diagonal elements of S are real.
00100 *
00101 *  =====================================================================
00102 *
00103 *     .. Parameters ..
00104       REAL               ONE, ZERO
00105       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00106 *     ..
00107 *     .. Local Scalars ..
00108       LOGICAL            UPPER
00109       INTEGER            J, KLD, KM, M
00110       REAL               AJJ
00111 *     ..
00112 *     .. External Functions ..
00113       LOGICAL            LSAME
00114       EXTERNAL           LSAME
00115 *     ..
00116 *     .. External Subroutines ..
00117       EXTERNAL           CHER, CLACGV, CSSCAL, XERBLA
00118 *     ..
00119 *     .. Intrinsic Functions ..
00120       INTRINSIC          MAX, MIN, REAL, SQRT
00121 *     ..
00122 *     .. Executable Statements ..
00123 *
00124 *     Test the input parameters.
00125 *
00126       INFO = 0
00127       UPPER = LSAME( UPLO, 'U' )
00128       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00129          INFO = -1
00130       ELSE IF( N.LT.0 ) THEN
00131          INFO = -2
00132       ELSE IF( KD.LT.0 ) THEN
00133          INFO = -3
00134       ELSE IF( LDAB.LT.KD+1 ) THEN
00135          INFO = -5
00136       END IF
00137       IF( INFO.NE.0 ) THEN
00138          CALL XERBLA( 'CPBSTF', -INFO )
00139          RETURN
00140       END IF
00141 *
00142 *     Quick return if possible
00143 *
00144       IF( N.EQ.0 )
00145      $   RETURN
00146 *
00147       KLD = MAX( 1, LDAB-1 )
00148 *
00149 *     Set the splitting point m.
00150 *
00151       M = ( N+KD ) / 2
00152 *
00153       IF( UPPER ) THEN
00154 *
00155 *        Factorize A(m+1:n,m+1:n) as L**H*L, and update A(1:m,1:m).
00156 *
00157          DO 10 J = N, M + 1, -1
00158 *
00159 *           Compute s(j,j) and test for non-positive-definiteness.
00160 *
00161             AJJ = REAL( AB( KD+1, J ) )
00162             IF( AJJ.LE.ZERO ) THEN
00163                AB( KD+1, J ) = AJJ
00164                GO TO 50
00165             END IF
00166             AJJ = SQRT( AJJ )
00167             AB( KD+1, J ) = AJJ
00168             KM = MIN( J-1, KD )
00169 *
00170 *           Compute elements j-km:j-1 of the j-th column and update the
00171 *           the leading submatrix within the band.
00172 *
00173             CALL CSSCAL( KM, ONE / AJJ, AB( KD+1-KM, J ), 1 )
00174             CALL CHER( 'Upper', KM, -ONE, AB( KD+1-KM, J ), 1,
00175      $                 AB( KD+1, J-KM ), KLD )
00176    10    CONTINUE
00177 *
00178 *        Factorize the updated submatrix A(1:m,1:m) as U**H*U.
00179 *
00180          DO 20 J = 1, M
00181 *
00182 *           Compute s(j,j) and test for non-positive-definiteness.
00183 *
00184             AJJ = REAL( AB( KD+1, J ) )
00185             IF( AJJ.LE.ZERO ) THEN
00186                AB( KD+1, J ) = AJJ
00187                GO TO 50
00188             END IF
00189             AJJ = SQRT( AJJ )
00190             AB( KD+1, J ) = AJJ
00191             KM = MIN( KD, M-J )
00192 *
00193 *           Compute elements j+1:j+km of the j-th row and update the
00194 *           trailing submatrix within the band.
00195 *
00196             IF( KM.GT.0 ) THEN
00197                CALL CSSCAL( KM, ONE / AJJ, AB( KD, J+1 ), KLD )
00198                CALL CLACGV( KM, AB( KD, J+1 ), KLD )
00199                CALL CHER( 'Upper', KM, -ONE, AB( KD, J+1 ), KLD,
00200      $                    AB( KD+1, J+1 ), KLD )
00201                CALL CLACGV( KM, AB( KD, J+1 ), KLD )
00202             END IF
00203    20    CONTINUE
00204       ELSE
00205 *
00206 *        Factorize A(m+1:n,m+1:n) as L**H*L, and update A(1:m,1:m).
00207 *
00208          DO 30 J = N, M + 1, -1
00209 *
00210 *           Compute s(j,j) and test for non-positive-definiteness.
00211 *
00212             AJJ = REAL( AB( 1, J ) )
00213             IF( AJJ.LE.ZERO ) THEN
00214                AB( 1, J ) = AJJ
00215                GO TO 50
00216             END IF
00217             AJJ = SQRT( AJJ )
00218             AB( 1, J ) = AJJ
00219             KM = MIN( J-1, KD )
00220 *
00221 *           Compute elements j-km:j-1 of the j-th row and update the
00222 *           trailing submatrix within the band.
00223 *
00224             CALL CSSCAL( KM, ONE / AJJ, AB( KM+1, J-KM ), KLD )
00225             CALL CLACGV( KM, AB( KM+1, J-KM ), KLD )
00226             CALL CHER( 'Lower', KM, -ONE, AB( KM+1, J-KM ), KLD,
00227      $                 AB( 1, J-KM ), KLD )
00228             CALL CLACGV( KM, AB( KM+1, J-KM ), KLD )
00229    30    CONTINUE
00230 *
00231 *        Factorize the updated submatrix A(1:m,1:m) as U**H*U.
00232 *
00233          DO 40 J = 1, M
00234 *
00235 *           Compute s(j,j) and test for non-positive-definiteness.
00236 *
00237             AJJ = REAL( AB( 1, J ) )
00238             IF( AJJ.LE.ZERO ) THEN
00239                AB( 1, J ) = AJJ
00240                GO TO 50
00241             END IF
00242             AJJ = SQRT( AJJ )
00243             AB( 1, J ) = AJJ
00244             KM = MIN( KD, M-J )
00245 *
00246 *           Compute elements j+1:j+km of the j-th column and update the
00247 *           trailing submatrix within the band.
00248 *
00249             IF( KM.GT.0 ) THEN
00250                CALL CSSCAL( KM, ONE / AJJ, AB( 2, J ), 1 )
00251                CALL CHER( 'Lower', KM, -ONE, AB( 2, J ), 1,
00252      $                    AB( 1, J+1 ), KLD )
00253             END IF
00254    40    CONTINUE
00255       END IF
00256       RETURN
00257 *
00258    50 CONTINUE
00259       INFO = J
00260       RETURN
00261 *
00262 *     End of CPBSTF
00263 *
00264       END
 All Files Functions