LAPACK 3.3.0

spbsv.f

Go to the documentation of this file.
00001       SUBROUTINE SPBSV( UPLO, N, KD, NRHS, AB, LDAB, B, LDB, INFO )
00002 *
00003 *  -- LAPACK driver 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, LDB, N, NRHS
00011 *     ..
00012 *     .. Array Arguments ..
00013       REAL               AB( LDAB, * ), B( LDB, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  SPBSV computes the solution to a real system of linear equations
00020 *     A * X = B,
00021 *  where A is an N-by-N symmetric positive definite band matrix and X
00022 *  and B are N-by-NRHS matrices.
00023 *
00024 *  The Cholesky decomposition is used to factor A as
00025 *     A = U**T * U,  if UPLO = 'U', or
00026 *     A = L * L**T,  if UPLO = 'L',
00027 *  where U is an upper triangular band matrix, and L is a lower
00028 *  triangular band matrix, with the same number of superdiagonals or
00029 *  subdiagonals as A.  The factored form of A is then used to solve the
00030 *  system of equations A * X = B.
00031 *
00032 *  Arguments
00033 *  =========
00034 *
00035 *  UPLO    (input) CHARACTER*1
00036 *          = 'U':  Upper triangle of A is stored;
00037 *          = 'L':  Lower triangle of A is stored.
00038 *
00039 *  N       (input) INTEGER
00040 *          The number of linear equations, i.e., the order of the
00041 *          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 *  NRHS    (input) INTEGER
00048 *          The number of right hand sides, i.e., the number of columns
00049 *          of the matrix B.  NRHS >= 0.
00050 *
00051 *  AB      (input/output) REAL array, dimension (LDAB,N)
00052 *          On entry, the upper or lower triangle of the symmetric band
00053 *          matrix A, stored in the first KD+1 rows of the array.  The
00054 *          j-th column of A is stored in the j-th column of the array AB
00055 *          as follows:
00056 *          if UPLO = 'U', AB(KD+1+i-j,j) = A(i,j) for max(1,j-KD)<=i<=j;
00057 *          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(N,j+KD).
00058 *          See below for further details.
00059 *
00060 *          On exit, if INFO = 0, the triangular factor U or L from the
00061 *          Cholesky factorization A = U**T*U or A = L*L**T of the band
00062 *          matrix A, in the same storage format as A.
00063 *
00064 *  LDAB    (input) INTEGER
00065 *          The leading dimension of the array AB.  LDAB >= KD+1.
00066 *
00067 *  B       (input/output) REAL array, dimension (LDB,NRHS)
00068 *          On entry, the N-by-NRHS right hand side matrix B.
00069 *          On exit, if INFO = 0, the N-by-NRHS solution matrix X.
00070 *
00071 *  LDB     (input) INTEGER
00072 *          The leading dimension of the array B.  LDB >= max(1,N).
00073 *
00074 *  INFO    (output) INTEGER
00075 *          = 0:  successful exit
00076 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00077 *          > 0:  if INFO = i, the leading minor of order i of A is not
00078 *                positive definite, so the factorization could not be
00079 *                completed, and the solution has not been computed.
00080 *
00081 *  Further Details
00082 *  ===============
00083 *
00084 *  The band storage scheme is illustrated by the following example, when
00085 *  N = 6, KD = 2, and UPLO = 'U':
00086 *
00087 *  On entry:                       On exit:
00088 *
00089 *      *    *   a13  a24  a35  a46      *    *   u13  u24  u35  u46
00090 *      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56
00091 *     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66
00092 *
00093 *  Similarly, if UPLO = 'L' the format of A is as follows:
00094 *
00095 *  On entry:                       On exit:
00096 *
00097 *     a11  a22  a33  a44  a55  a66     l11  l22  l33  l44  l55  l66
00098 *     a21  a32  a43  a54  a65   *      l21  l32  l43  l54  l65   *
00099 *     a31  a42  a53  a64   *    *      l31  l42  l53  l64   *    *
00100 *
00101 *  Array elements marked * are not used by the routine.
00102 *
00103 *  =====================================================================
00104 *
00105 *     .. External Functions ..
00106       LOGICAL            LSAME
00107       EXTERNAL           LSAME
00108 *     ..
00109 *     .. External Subroutines ..
00110       EXTERNAL           SPBTRF, SPBTRS, XERBLA
00111 *     ..
00112 *     .. Intrinsic Functions ..
00113       INTRINSIC          MAX
00114 *     ..
00115 *     .. Executable Statements ..
00116 *
00117 *     Test the input parameters.
00118 *
00119       INFO = 0
00120       IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00121          INFO = -1
00122       ELSE IF( N.LT.0 ) THEN
00123          INFO = -2
00124       ELSE IF( KD.LT.0 ) THEN
00125          INFO = -3
00126       ELSE IF( NRHS.LT.0 ) THEN
00127          INFO = -4
00128       ELSE IF( LDAB.LT.KD+1 ) THEN
00129          INFO = -6
00130       ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
00131          INFO = -8
00132       END IF
00133       IF( INFO.NE.0 ) THEN
00134          CALL XERBLA( 'SPBSV ', -INFO )
00135          RETURN
00136       END IF
00137 *
00138 *     Compute the Cholesky factorization A = U'*U or A = L*L'.
00139 *
00140       CALL SPBTRF( UPLO, N, KD, AB, LDAB, INFO )
00141       IF( INFO.EQ.0 ) THEN
00142 *
00143 *        Solve the system A*X = B, overwriting B with X.
00144 *
00145          CALL SPBTRS( UPLO, N, KD, NRHS, AB, LDAB, B, LDB, INFO )
00146 *
00147       END IF
00148       RETURN
00149 *
00150 *     End of SPBSV
00151 *
00152       END
 All Files Functions