LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
spbstf.f
Go to the documentation of this file.
00001 *> \brief \b SPBSTF
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SPBSTF + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spbstf.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spbstf.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spbstf.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE SPBSTF( UPLO, N, KD, AB, LDAB, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       CHARACTER          UPLO
00025 *       INTEGER            INFO, KD, LDAB, N
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       REAL               AB( LDAB, * )
00029 *       ..
00030 *  
00031 *
00032 *> \par Purpose:
00033 *  =============
00034 *>
00035 *> \verbatim
00036 *>
00037 *> SPBSTF computes a split Cholesky factorization of a real
00038 *> symmetric positive definite band matrix A.
00039 *>
00040 *> This routine is designed to be used in conjunction with SSBGST.
00041 *>
00042 *> The factorization has the form  A = S**T*S  where S is a band matrix
00043 *> of the same bandwidth as A and the following structure:
00044 *>
00045 *>   S = ( U    )
00046 *>       ( M  L )
00047 *>
00048 *> where U is upper triangular of order m = (n+kd)/2, and L is lower
00049 *> triangular of order n-m.
00050 *> \endverbatim
00051 *
00052 *  Arguments:
00053 *  ==========
00054 *
00055 *> \param[in] UPLO
00056 *> \verbatim
00057 *>          UPLO is CHARACTER*1
00058 *>          = 'U':  Upper triangle of A is stored;
00059 *>          = 'L':  Lower triangle of A is stored.
00060 *> \endverbatim
00061 *>
00062 *> \param[in] N
00063 *> \verbatim
00064 *>          N is INTEGER
00065 *>          The order of the matrix A.  N >= 0.
00066 *> \endverbatim
00067 *>
00068 *> \param[in] KD
00069 *> \verbatim
00070 *>          KD is INTEGER
00071 *>          The number of superdiagonals of the matrix A if UPLO = 'U',
00072 *>          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
00073 *> \endverbatim
00074 *>
00075 *> \param[in,out] AB
00076 *> \verbatim
00077 *>          AB is REAL array, dimension (LDAB,N)
00078 *>          On entry, the upper or lower triangle of the symmetric band
00079 *>          matrix A, stored in the first kd+1 rows of the array.  The
00080 *>          j-th column of A is stored in the j-th column of the array AB
00081 *>          as follows:
00082 *>          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
00083 *>          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
00084 *>
00085 *>          On exit, if INFO = 0, the factor S from the split Cholesky
00086 *>          factorization A = S**T*S. See Further Details.
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 = -i, the i-th argument had an illegal value
00100 *>          > 0: if INFO = i, the factorization could not be completed,
00101 *>               because the updated element a(i,i) was negative; the
00102 *>               matrix A is not positive definite.
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 realOTHERcomputational
00116 *
00117 *> \par Further Details:
00118 *  =====================
00119 *>
00120 *> \verbatim
00121 *>
00122 *>  The band storage scheme is illustrated by the following example, when
00123 *>  N = 7, KD = 2:
00124 *>
00125 *>  S = ( s11  s12  s13                     )
00126 *>      (      s22  s23  s24                )
00127 *>      (           s33  s34                )
00128 *>      (                s44                )
00129 *>      (           s53  s54  s55           )
00130 *>      (                s64  s65  s66      )
00131 *>      (                     s75  s76  s77 )
00132 *>
00133 *>  If UPLO = 'U', the array AB holds:
00134 *>
00135 *>  on entry:                          on exit:
00136 *>
00137 *>   *    *   a13  a24  a35  a46  a57   *    *   s13  s24  s53  s64  s75
00138 *>   *   a12  a23  a34  a45  a56  a67   *   s12  s23  s34  s54  s65  s76
00139 *>  a11  a22  a33  a44  a55  a66  a77  s11  s22  s33  s44  s55  s66  s77
00140 *>
00141 *>  If UPLO = 'L', the array AB holds:
00142 *>
00143 *>  on entry:                          on exit:
00144 *>
00145 *>  a11  a22  a33  a44  a55  a66  a77  s11  s22  s33  s44  s55  s66  s77
00146 *>  a21  a32  a43  a54  a65  a76   *   s12  s23  s34  s54  s65  s76   *
00147 *>  a31  a42  a53  a64  a64   *    *   s13  s24  s53  s64  s75   *    *
00148 *>
00149 *>  Array elements marked * are not used by the routine.
00150 *> \endverbatim
00151 *>
00152 *  =====================================================================
00153       SUBROUTINE SPBSTF( UPLO, N, KD, AB, LDAB, INFO )
00154 *
00155 *  -- LAPACK computational routine (version 3.4.0) --
00156 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00157 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00158 *     November 2011
00159 *
00160 *     .. Scalar Arguments ..
00161       CHARACTER          UPLO
00162       INTEGER            INFO, KD, LDAB, N
00163 *     ..
00164 *     .. Array Arguments ..
00165       REAL               AB( LDAB, * )
00166 *     ..
00167 *
00168 *  =====================================================================
00169 *
00170 *     .. Parameters ..
00171       REAL               ONE, ZERO
00172       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00173 *     ..
00174 *     .. Local Scalars ..
00175       LOGICAL            UPPER
00176       INTEGER            J, KLD, KM, M
00177       REAL               AJJ
00178 *     ..
00179 *     .. External Functions ..
00180       LOGICAL            LSAME
00181       EXTERNAL           LSAME
00182 *     ..
00183 *     .. External Subroutines ..
00184       EXTERNAL           SSCAL, SSYR, XERBLA
00185 *     ..
00186 *     .. Intrinsic Functions ..
00187       INTRINSIC          MAX, MIN, SQRT
00188 *     ..
00189 *     .. Executable Statements ..
00190 *
00191 *     Test the input parameters.
00192 *
00193       INFO = 0
00194       UPPER = LSAME( UPLO, 'U' )
00195       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00196          INFO = -1
00197       ELSE IF( N.LT.0 ) THEN
00198          INFO = -2
00199       ELSE IF( KD.LT.0 ) THEN
00200          INFO = -3
00201       ELSE IF( LDAB.LT.KD+1 ) THEN
00202          INFO = -5
00203       END IF
00204       IF( INFO.NE.0 ) THEN
00205          CALL XERBLA( 'SPBSTF', -INFO )
00206          RETURN
00207       END IF
00208 *
00209 *     Quick return if possible
00210 *
00211       IF( N.EQ.0 )
00212      $   RETURN
00213 *
00214       KLD = MAX( 1, LDAB-1 )
00215 *
00216 *     Set the splitting point m.
00217 *
00218       M = ( N+KD ) / 2
00219 *
00220       IF( UPPER ) THEN
00221 *
00222 *        Factorize A(m+1:n,m+1:n) as L**T*L, and update A(1:m,1:m).
00223 *
00224          DO 10 J = N, M + 1, -1
00225 *
00226 *           Compute s(j,j) and test for non-positive-definiteness.
00227 *
00228             AJJ = AB( KD+1, J )
00229             IF( AJJ.LE.ZERO )
00230      $         GO TO 50
00231             AJJ = SQRT( AJJ )
00232             AB( KD+1, J ) = AJJ
00233             KM = MIN( J-1, KD )
00234 *
00235 *           Compute elements j-km:j-1 of the j-th column and update the
00236 *           the leading submatrix within the band.
00237 *
00238             CALL SSCAL( KM, ONE / AJJ, AB( KD+1-KM, J ), 1 )
00239             CALL SSYR( 'Upper', KM, -ONE, AB( KD+1-KM, J ), 1,
00240      $                 AB( KD+1, J-KM ), KLD )
00241    10    CONTINUE
00242 *
00243 *        Factorize the updated submatrix A(1:m,1:m) as U**T*U.
00244 *
00245          DO 20 J = 1, M
00246 *
00247 *           Compute s(j,j) and test for non-positive-definiteness.
00248 *
00249             AJJ = AB( KD+1, J )
00250             IF( AJJ.LE.ZERO )
00251      $         GO TO 50
00252             AJJ = SQRT( AJJ )
00253             AB( KD+1, J ) = AJJ
00254             KM = MIN( KD, M-J )
00255 *
00256 *           Compute elements j+1:j+km of the j-th row and update the
00257 *           trailing submatrix within the band.
00258 *
00259             IF( KM.GT.0 ) THEN
00260                CALL SSCAL( KM, ONE / AJJ, AB( KD, J+1 ), KLD )
00261                CALL SSYR( 'Upper', KM, -ONE, AB( KD, J+1 ), KLD,
00262      $                    AB( KD+1, J+1 ), KLD )
00263             END IF
00264    20    CONTINUE
00265       ELSE
00266 *
00267 *        Factorize A(m+1:n,m+1:n) as L**T*L, and update A(1:m,1:m).
00268 *
00269          DO 30 J = N, M + 1, -1
00270 *
00271 *           Compute s(j,j) and test for non-positive-definiteness.
00272 *
00273             AJJ = AB( 1, J )
00274             IF( AJJ.LE.ZERO )
00275      $         GO TO 50
00276             AJJ = SQRT( AJJ )
00277             AB( 1, J ) = AJJ
00278             KM = MIN( J-1, KD )
00279 *
00280 *           Compute elements j-km:j-1 of the j-th row and update the
00281 *           trailing submatrix within the band.
00282 *
00283             CALL SSCAL( KM, ONE / AJJ, AB( KM+1, J-KM ), KLD )
00284             CALL SSYR( 'Lower', KM, -ONE, AB( KM+1, J-KM ), KLD,
00285      $                 AB( 1, J-KM ), KLD )
00286    30    CONTINUE
00287 *
00288 *        Factorize the updated submatrix A(1:m,1:m) as U**T*U.
00289 *
00290          DO 40 J = 1, M
00291 *
00292 *           Compute s(j,j) and test for non-positive-definiteness.
00293 *
00294             AJJ = AB( 1, J )
00295             IF( AJJ.LE.ZERO )
00296      $         GO TO 50
00297             AJJ = SQRT( AJJ )
00298             AB( 1, J ) = AJJ
00299             KM = MIN( KD, M-J )
00300 *
00301 *           Compute elements j+1:j+km of the j-th column and update the
00302 *           trailing submatrix within the band.
00303 *
00304             IF( KM.GT.0 ) THEN
00305                CALL SSCAL( KM, ONE / AJJ, AB( 2, J ), 1 )
00306                CALL SSYR( 'Lower', KM, -ONE, AB( 2, J ), 1,
00307      $                    AB( 1, J+1 ), KLD )
00308             END IF
00309    40    CONTINUE
00310       END IF
00311       RETURN
00312 *
00313    50 CONTINUE
00314       INFO = J
00315       RETURN
00316 *
00317 *     End of SPBSTF
00318 *
00319       END
 All Files Functions