LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
cpbtf2.f
Go to the documentation of this file.
00001 *> \brief \b CPBTF2
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download CPBTF2 + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpbtf2.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpbtf2.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpbtf2.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE CPBTF2( UPLO, N, KD, AB, LDAB, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, KD, LDAB, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       COMPLEX            AB( LDAB, * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> CPBTF2 computes the Cholesky factorization of a complex Hermitian
00038 *> positive definite band matrix A.
00039 *>
00040 *> The factorization has the form
00041 *>    A = U**H * U ,  if UPLO = 'U', or
00042 *>    A = L  * L**H,  if UPLO = 'L',
00043 *> where U is an upper triangular matrix, U**H is the conjugate transpose
00044 *> of U, and L is lower triangular.
00045 *>
00046 *> This is the unblocked version of the algorithm, calling Level 2 BLAS.
00047 *> \endverbatim
00048 *
00049 *  Arguments:
00050 *  ==========
00051 *
00052 *> \param[in] UPLO
00053 *> \verbatim
00054 *>          UPLO is CHARACTER*1
00055 *>          Specifies whether the upper or lower triangular part of the
00056 *>          Hermitian matrix A is stored:
00057 *>          = 'U':  Upper triangular
00058 *>          = 'L':  Lower triangular
00059 *> \endverbatim
00060 *>
00061 *> \param[in] N
00062 *> \verbatim
00063 *>          N is INTEGER
00064 *>          The order of the matrix A.  N >= 0.
00065 *> \endverbatim
00066 *>
00067 *> \param[in] KD
00068 *> \verbatim
00069 *>          KD is INTEGER
00070 *>          The number of super-diagonals of the matrix A if UPLO = 'U',
00071 *>          or the number of sub-diagonals if UPLO = 'L'.  KD >= 0.
00072 *> \endverbatim
00073 *>
00074 *> \param[in,out] AB
00075 *> \verbatim
00076 *>          AB is COMPLEX array, dimension (LDAB,N)
00077 *>          On entry, the upper or lower triangle of the Hermitian band
00078 *>          matrix A, stored in the first KD+1 rows of the array.  The
00079 *>          j-th column of A is stored in the j-th column of the array AB
00080 *>          as follows:
00081 *>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
00082 *>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
00083 *>
00084 *>          On exit, if INFO = 0, the triangular factor U or L from the
00085 *>          Cholesky factorization A = U**H *U or A = L*L**H of the band
00086 *>          matrix A, in the same storage format as A.
00087 *> \endverbatim
00088 *>
00089 *> \param[in] LDAB
00090 *> \verbatim
00091 *>          LDAB is INTEGER
00092 *>          The leading dimension of the array AB.  LDAB >= KD+1.
00093 *> \endverbatim
00094 *>
00095 *> \param[out] INFO
00096 *> \verbatim
00097 *>          INFO is INTEGER
00098 *>          = 0: successful exit
00099 *>          < 0: if INFO = -k, the k-th argument had an illegal value
00100 *>          > 0: if INFO = k, the leading minor of order k is not
00101 *>               positive definite, and the factorization could not be
00102 *>               completed.
00103 *> \endverbatim
00104 *
00105 *  Authors:
00106 *  ========
00107 *
00108 *> \author Univ. of Tennessee 
00109 *> \author Univ. of California Berkeley 
00110 *> \author Univ. of Colorado Denver 
00111 *> \author NAG Ltd. 
00112 *
00113 *> \date November 2011
00114 *
00115 *> \ingroup complexOTHERcomputational
00116 *
00117 *> \par Further Details:
00118 *  =====================
00119 *>
00120 *> \verbatim
00121 *>
00122 *>  The band storage scheme is illustrated by the following example, when
00123 *>  N = 6, KD = 2, and UPLO = 'U':
00124 *>
00125 *>  On entry:                       On exit:
00126 *>
00127 *>      *    *   a13  a24  a35  a46      *    *   u13  u24  u35  u46
00128 *>      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56
00129 *>     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66
00130 *>
00131 *>  Similarly, if UPLO = 'L' the format of A is as follows:
00132 *>
00133 *>  On entry:                       On exit:
00134 *>
00135 *>     a11  a22  a33  a44  a55  a66     l11  l22  l33  l44  l55  l66
00136 *>     a21  a32  a43  a54  a65   *      l21  l32  l43  l54  l65   *
00137 *>     a31  a42  a53  a64   *    *      l31  l42  l53  l64   *    *
00138 *>
00139 *>  Array elements marked * are not used by the routine.
00140 *> \endverbatim
00141 *>
00142 *  =====================================================================
00143       SUBROUTINE CPBTF2( UPLO, N, KD, AB, LDAB, INFO )
00144 *
00145 *  -- LAPACK computational routine (version 3.4.0) --
00146 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00147 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00148 *     November 2011
00149 *
00150 *     .. Scalar Arguments ..
00151       CHARACTER          UPLO
00152       INTEGER            INFO, KD, LDAB, N
00153 *     ..
00154 *     .. Array Arguments ..
00155       COMPLEX            AB( LDAB, * )
00156 *     ..
00157 *
00158 *  =====================================================================
00159 *
00160 *     .. Parameters ..
00161       REAL               ONE, ZERO
00162       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00163 *     ..
00164 *     .. Local Scalars ..
00165       LOGICAL            UPPER
00166       INTEGER            J, KLD, KN
00167       REAL               AJJ
00168 *     ..
00169 *     .. External Functions ..
00170       LOGICAL            LSAME
00171       EXTERNAL           LSAME
00172 *     ..
00173 *     .. External Subroutines ..
00174       EXTERNAL           CHER, CLACGV, CSSCAL, XERBLA
00175 *     ..
00176 *     .. Intrinsic Functions ..
00177       INTRINSIC          MAX, MIN, REAL, SQRT
00178 *     ..
00179 *     .. Executable Statements ..
00180 *
00181 *     Test the input parameters.
00182 *
00183       INFO = 0
00184       UPPER = LSAME( UPLO, 'U' )
00185       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00186          INFO = -1
00187       ELSE IF( N.LT.0 ) THEN
00188          INFO = -2
00189       ELSE IF( KD.LT.0 ) THEN
00190          INFO = -3
00191       ELSE IF( LDAB.LT.KD+1 ) THEN
00192          INFO = -5
00193       END IF
00194       IF( INFO.NE.0 ) THEN
00195          CALL XERBLA( 'CPBTF2', -INFO )
00196          RETURN
00197       END IF
00198 *
00199 *     Quick return if possible
00200 *
00201       IF( N.EQ.0 )
00202      $   RETURN
00203 *
00204       KLD = MAX( 1, LDAB-1 )
00205 *
00206       IF( UPPER ) THEN
00207 *
00208 *        Compute the Cholesky factorization A = U**H * U.
00209 *
00210          DO 10 J = 1, N
00211 *
00212 *           Compute U(J,J) and test for non-positive-definiteness.
00213 *
00214             AJJ = REAL( AB( KD+1, J ) )
00215             IF( AJJ.LE.ZERO ) THEN
00216                AB( KD+1, J ) = AJJ
00217                GO TO 30
00218             END IF
00219             AJJ = SQRT( AJJ )
00220             AB( KD+1, J ) = AJJ
00221 *
00222 *           Compute elements J+1:J+KN of row J and update the
00223 *           trailing submatrix within the band.
00224 *
00225             KN = MIN( KD, N-J )
00226             IF( KN.GT.0 ) THEN
00227                CALL CSSCAL( KN, ONE / AJJ, AB( KD, J+1 ), KLD )
00228                CALL CLACGV( KN, AB( KD, J+1 ), KLD )
00229                CALL CHER( 'Upper', KN, -ONE, AB( KD, J+1 ), KLD,
00230      $                    AB( KD+1, J+1 ), KLD )
00231                CALL CLACGV( KN, AB( KD, J+1 ), KLD )
00232             END IF
00233    10    CONTINUE
00234       ELSE
00235 *
00236 *        Compute the Cholesky factorization A = L*L**H.
00237 *
00238          DO 20 J = 1, N
00239 *
00240 *           Compute L(J,J) and test for non-positive-definiteness.
00241 *
00242             AJJ = REAL( AB( 1, J ) )
00243             IF( AJJ.LE.ZERO ) THEN
00244                AB( 1, J ) = AJJ
00245                GO TO 30
00246             END IF
00247             AJJ = SQRT( AJJ )
00248             AB( 1, J ) = AJJ
00249 *
00250 *           Compute elements J+1:J+KN of column J and update the
00251 *           trailing submatrix within the band.
00252 *
00253             KN = MIN( KD, N-J )
00254             IF( KN.GT.0 ) THEN
00255                CALL CSSCAL( KN, ONE / AJJ, AB( 2, J ), 1 )
00256                CALL CHER( 'Lower', KN, -ONE, AB( 2, J ), 1,
00257      $                    AB( 1, J+1 ), KLD )
00258             END IF
00259    20    CONTINUE
00260       END IF
00261       RETURN
00262 *
00263    30 CONTINUE
00264       INFO = J
00265       RETURN
00266 *
00267 *     End of CPBTF2
00268 *
00269       END
 All Files Functions