LAPACK 3.3.0

spbcon.f

Go to the documentation of this file.
00001       SUBROUTINE SPBCON( UPLO, N, KD, AB, LDAB, ANORM, RCOND, WORK,
00002      $                   IWORK, INFO )
00003 *
00004 *  -- LAPACK routine (version 3.2) --
00005 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00006 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00007 *     November 2006
00008 *
00009 *     Modified to call SLACN2 in place of SLACON, 7 Feb 03, SJH.
00010 *
00011 *     .. Scalar Arguments ..
00012       CHARACTER          UPLO
00013       INTEGER            INFO, KD, LDAB, N
00014       REAL               ANORM, RCOND
00015 *     ..
00016 *     .. Array Arguments ..
00017       INTEGER            IWORK( * )
00018       REAL               AB( LDAB, * ), WORK( * )
00019 *     ..
00020 *
00021 *  Purpose
00022 *  =======
00023 *
00024 *  SPBCON estimates the reciprocal of the condition number (in the
00025 *  1-norm) of a real symmetric positive definite band matrix using the
00026 *  Cholesky factorization A = U**T*U or A = L*L**T computed by SPBTRF.
00027 *
00028 *  An estimate is obtained for norm(inv(A)), and the reciprocal of the
00029 *  condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
00030 *
00031 *  Arguments
00032 *  =========
00033 *
00034 *  UPLO    (input) CHARACTER*1
00035 *          = 'U':  Upper triangular factor stored in AB;
00036 *          = 'L':  Lower triangular factor stored in AB.
00037 *
00038 *  N       (input) INTEGER
00039 *          The order of the matrix A.  N >= 0.
00040 *
00041 *  KD      (input) INTEGER
00042 *          The number of superdiagonals of the matrix A if UPLO = 'U',
00043 *          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
00044 *
00045 *  AB      (input) REAL array, dimension (LDAB,N)
00046 *          The triangular factor U or L from the Cholesky factorization
00047 *          A = U**T*U or A = L*L**T of the band matrix A, stored in the
00048 *          first KD+1 rows of the array.  The j-th column of U or L is
00049 *          stored in the j-th column of the array AB as follows:
00050 *          if UPLO ='U', AB(kd+1+i-j,j) = U(i,j) for max(1,j-kd)<=i<=j;
00051 *          if UPLO ='L', AB(1+i-j,j)    = L(i,j) for j<=i<=min(n,j+kd).
00052 *
00053 *  LDAB    (input) INTEGER
00054 *          The leading dimension of the array AB.  LDAB >= KD+1.
00055 *
00056 *  ANORM   (input) REAL
00057 *          The 1-norm (or infinity-norm) of the symmetric band matrix A.
00058 *
00059 *  RCOND   (output) REAL
00060 *          The reciprocal of the condition number of the matrix A,
00061 *          computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
00062 *          estimate of the 1-norm of inv(A) computed in this routine.
00063 *
00064 *  WORK    (workspace) REAL array, dimension (3*N)
00065 *
00066 *  IWORK   (workspace) INTEGER array, dimension (N)
00067 *
00068 *  INFO    (output) INTEGER
00069 *          = 0:  successful exit
00070 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00071 *
00072 *  =====================================================================
00073 *
00074 *     .. Parameters ..
00075       REAL               ONE, ZERO
00076       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00077 *     ..
00078 *     .. Local Scalars ..
00079       LOGICAL            UPPER
00080       CHARACTER          NORMIN
00081       INTEGER            IX, KASE
00082       REAL               AINVNM, SCALE, SCALEL, SCALEU, SMLNUM
00083 *     ..
00084 *     .. Local Arrays ..
00085       INTEGER            ISAVE( 3 )
00086 *     ..
00087 *     .. External Functions ..
00088       LOGICAL            LSAME
00089       INTEGER            ISAMAX
00090       REAL               SLAMCH
00091       EXTERNAL           LSAME, ISAMAX, SLAMCH
00092 *     ..
00093 *     .. External Subroutines ..
00094       EXTERNAL           SLACN2, SLATBS, SRSCL, XERBLA
00095 *     ..
00096 *     .. Intrinsic Functions ..
00097       INTRINSIC          ABS
00098 *     ..
00099 *     .. Executable Statements ..
00100 *
00101 *     Test the input parameters.
00102 *
00103       INFO = 0
00104       UPPER = LSAME( UPLO, 'U' )
00105       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00106          INFO = -1
00107       ELSE IF( N.LT.0 ) THEN
00108          INFO = -2
00109       ELSE IF( KD.LT.0 ) THEN
00110          INFO = -3
00111       ELSE IF( LDAB.LT.KD+1 ) THEN
00112          INFO = -5
00113       ELSE IF( ANORM.LT.ZERO ) THEN
00114          INFO = -6
00115       END IF
00116       IF( INFO.NE.0 ) THEN
00117          CALL XERBLA( 'SPBCON', -INFO )
00118          RETURN
00119       END IF
00120 *
00121 *     Quick return if possible
00122 *
00123       RCOND = ZERO
00124       IF( N.EQ.0 ) THEN
00125          RCOND = ONE
00126          RETURN
00127       ELSE IF( ANORM.EQ.ZERO ) THEN
00128          RETURN
00129       END IF
00130 *
00131       SMLNUM = SLAMCH( 'Safe minimum' )
00132 *
00133 *     Estimate the 1-norm of the inverse.
00134 *
00135       KASE = 0
00136       NORMIN = 'N'
00137    10 CONTINUE
00138       CALL SLACN2( N, WORK( N+1 ), WORK, IWORK, AINVNM, KASE, ISAVE )
00139       IF( KASE.NE.0 ) THEN
00140          IF( UPPER ) THEN
00141 *
00142 *           Multiply by inv(U').
00143 *
00144             CALL SLATBS( 'Upper', 'Transpose', 'Non-unit', NORMIN, N,
00145      $                   KD, AB, LDAB, WORK, SCALEL, WORK( 2*N+1 ),
00146      $                   INFO )
00147             NORMIN = 'Y'
00148 *
00149 *           Multiply by inv(U).
00150 *
00151             CALL SLATBS( 'Upper', 'No transpose', 'Non-unit', NORMIN, N,
00152      $                   KD, AB, LDAB, WORK, SCALEU, WORK( 2*N+1 ),
00153      $                   INFO )
00154          ELSE
00155 *
00156 *           Multiply by inv(L).
00157 *
00158             CALL SLATBS( 'Lower', 'No transpose', 'Non-unit', NORMIN, N,
00159      $                   KD, AB, LDAB, WORK, SCALEL, WORK( 2*N+1 ),
00160      $                   INFO )
00161             NORMIN = 'Y'
00162 *
00163 *           Multiply by inv(L').
00164 *
00165             CALL SLATBS( 'Lower', 'Transpose', 'Non-unit', NORMIN, N,
00166      $                   KD, AB, LDAB, WORK, SCALEU, WORK( 2*N+1 ),
00167      $                   INFO )
00168          END IF
00169 *
00170 *        Multiply by 1/SCALE if doing so will not cause overflow.
00171 *
00172          SCALE = SCALEL*SCALEU
00173          IF( SCALE.NE.ONE ) THEN
00174             IX = ISAMAX( N, WORK, 1 )
00175             IF( SCALE.LT.ABS( WORK( IX ) )*SMLNUM .OR. SCALE.EQ.ZERO )
00176      $         GO TO 20
00177             CALL SRSCL( N, SCALE, WORK, 1 )
00178          END IF
00179          GO TO 10
00180       END IF
00181 *
00182 *     Compute the estimate of the reciprocal condition number.
00183 *
00184       IF( AINVNM.NE.ZERO )
00185      $   RCOND = ( ONE / AINVNM ) / ANORM
00186 *
00187    20 CONTINUE
00188 *
00189       RETURN
00190 *
00191 *     End of SPBCON
00192 *
00193       END
 All Files Functions