LAPACK 3.3.0
|
00001 SUBROUTINE SLAQSB( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, EQUED ) 00002 * 00003 * -- LAPACK auxiliary 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 EQUED, UPLO 00010 INTEGER KD, LDAB, N 00011 REAL AMAX, SCOND 00012 * .. 00013 * .. Array Arguments .. 00014 REAL AB( LDAB, * ), S( * ) 00015 * .. 00016 * 00017 * Purpose 00018 * ======= 00019 * 00020 * SLAQSB equilibrates a symmetric band matrix A using the scaling 00021 * factors in the vector S. 00022 * 00023 * Arguments 00024 * ========= 00025 * 00026 * UPLO (input) CHARACTER*1 00027 * Specifies whether the upper or lower triangular part of the 00028 * symmetric matrix A is stored. 00029 * = 'U': Upper triangular 00030 * = 'L': Lower triangular 00031 * 00032 * N (input) INTEGER 00033 * The order of the matrix A. N >= 0. 00034 * 00035 * KD (input) INTEGER 00036 * The number of super-diagonals of the matrix A if UPLO = 'U', 00037 * or the number of sub-diagonals if UPLO = 'L'. KD >= 0. 00038 * 00039 * AB (input/output) REAL array, dimension (LDAB,N) 00040 * On entry, the upper or lower triangle of the symmetric band 00041 * matrix A, stored in the first KD+1 rows of the array. The 00042 * j-th column of A is stored in the j-th column of the array AB 00043 * as follows: 00044 * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; 00045 * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd). 00046 * 00047 * On exit, if INFO = 0, the triangular factor U or L from the 00048 * Cholesky factorization A = U'*U or A = L*L' of the band 00049 * matrix A, in the same storage format as A. 00050 * 00051 * LDAB (input) INTEGER 00052 * The leading dimension of the array AB. LDAB >= KD+1. 00053 * 00054 * S (input) REAL array, dimension (N) 00055 * The scale factors for A. 00056 * 00057 * SCOND (input) REAL 00058 * Ratio of the smallest S(i) to the largest S(i). 00059 * 00060 * AMAX (input) REAL 00061 * Absolute value of largest matrix entry. 00062 * 00063 * EQUED (output) CHARACTER*1 00064 * Specifies whether or not equilibration was done. 00065 * = 'N': No equilibration. 00066 * = 'Y': Equilibration was done, i.e., A has been replaced by 00067 * diag(S) * A * diag(S). 00068 * 00069 * Internal Parameters 00070 * =================== 00071 * 00072 * THRESH is a threshold value used to decide if scaling should be done 00073 * based on the ratio of the scaling factors. If SCOND < THRESH, 00074 * scaling is done. 00075 * 00076 * LARGE and SMALL are threshold values used to decide if scaling should 00077 * be done based on the absolute size of the largest matrix element. 00078 * If AMAX > LARGE or AMAX < SMALL, scaling is done. 00079 * 00080 * ===================================================================== 00081 * 00082 * .. Parameters .. 00083 REAL ONE, THRESH 00084 PARAMETER ( ONE = 1.0E+0, THRESH = 0.1E+0 ) 00085 * .. 00086 * .. Local Scalars .. 00087 INTEGER I, J 00088 REAL CJ, LARGE, SMALL 00089 * .. 00090 * .. External Functions .. 00091 LOGICAL LSAME 00092 REAL SLAMCH 00093 EXTERNAL LSAME, SLAMCH 00094 * .. 00095 * .. Intrinsic Functions .. 00096 INTRINSIC MAX, MIN 00097 * .. 00098 * .. Executable Statements .. 00099 * 00100 * Quick return if possible 00101 * 00102 IF( N.LE.0 ) THEN 00103 EQUED = 'N' 00104 RETURN 00105 END IF 00106 * 00107 * Initialize LARGE and SMALL. 00108 * 00109 SMALL = SLAMCH( 'Safe minimum' ) / SLAMCH( 'Precision' ) 00110 LARGE = ONE / SMALL 00111 * 00112 IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN 00113 * 00114 * No equilibration 00115 * 00116 EQUED = 'N' 00117 ELSE 00118 * 00119 * Replace A by diag(S) * A * diag(S). 00120 * 00121 IF( LSAME( UPLO, 'U' ) ) THEN 00122 * 00123 * Upper triangle of A is stored in band format. 00124 * 00125 DO 20 J = 1, N 00126 CJ = S( J ) 00127 DO 10 I = MAX( 1, J-KD ), J 00128 AB( KD+1+I-J, J ) = CJ*S( I )*AB( KD+1+I-J, J ) 00129 10 CONTINUE 00130 20 CONTINUE 00131 ELSE 00132 * 00133 * Lower triangle of A is stored. 00134 * 00135 DO 40 J = 1, N 00136 CJ = S( J ) 00137 DO 30 I = J, MIN( N, J+KD ) 00138 AB( 1+I-J, J ) = CJ*S( I )*AB( 1+I-J, J ) 00139 30 CONTINUE 00140 40 CONTINUE 00141 END IF 00142 EQUED = 'Y' 00143 END IF 00144 * 00145 RETURN 00146 * 00147 * End of SLAQSB 00148 * 00149 END