00001 /* slaqsb.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int slaqsb_(char *uplo, integer *n, integer *kd, real *ab, 00017 integer *ldab, real *s, real *scond, real *amax, char *equed) 00018 { 00019 /* System generated locals */ 00020 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4; 00021 00022 /* Local variables */ 00023 integer i__, j; 00024 real cj, large; 00025 extern logical lsame_(char *, char *); 00026 real small; 00027 extern doublereal slamch_(char *); 00028 00029 00030 /* -- LAPACK auxiliary routine (version 3.2) -- */ 00031 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00032 /* November 2006 */ 00033 00034 /* .. Scalar Arguments .. */ 00035 /* .. */ 00036 /* .. Array Arguments .. */ 00037 /* .. */ 00038 00039 /* Purpose */ 00040 /* ======= */ 00041 00042 /* SLAQSB equilibrates a symmetric band matrix A using the scaling */ 00043 /* factors in the vector S. */ 00044 00045 /* Arguments */ 00046 /* ========= */ 00047 00048 /* UPLO (input) CHARACTER*1 */ 00049 /* Specifies whether the upper or lower triangular part of the */ 00050 /* symmetric matrix A is stored. */ 00051 /* = 'U': Upper triangular */ 00052 /* = 'L': Lower triangular */ 00053 00054 /* N (input) INTEGER */ 00055 /* The order of the matrix A. N >= 0. */ 00056 00057 /* KD (input) INTEGER */ 00058 /* The number of super-diagonals of the matrix A if UPLO = 'U', */ 00059 /* or the number of sub-diagonals if UPLO = 'L'. KD >= 0. */ 00060 00061 /* AB (input/output) REAL array, dimension (LDAB,N) */ 00062 /* On entry, the upper or lower triangle of the symmetric band */ 00063 /* matrix A, stored in the first KD+1 rows of the array. The */ 00064 /* j-th column of A is stored in the j-th column of the array AB */ 00065 /* as follows: */ 00066 /* if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; */ 00067 /* if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd). */ 00068 00069 /* On exit, if INFO = 0, the triangular factor U or L from the */ 00070 /* Cholesky factorization A = U'*U or A = L*L' of the band */ 00071 /* matrix A, in the same storage format as A. */ 00072 00073 /* LDAB (input) INTEGER */ 00074 /* The leading dimension of the array AB. LDAB >= KD+1. */ 00075 00076 /* S (input) REAL array, dimension (N) */ 00077 /* The scale factors for A. */ 00078 00079 /* SCOND (input) REAL */ 00080 /* Ratio of the smallest S(i) to the largest S(i). */ 00081 00082 /* AMAX (input) REAL */ 00083 /* Absolute value of largest matrix entry. */ 00084 00085 /* EQUED (output) CHARACTER*1 */ 00086 /* Specifies whether or not equilibration was done. */ 00087 /* = 'N': No equilibration. */ 00088 /* = 'Y': Equilibration was done, i.e., A has been replaced by */ 00089 /* diag(S) * A * diag(S). */ 00090 00091 /* Internal Parameters */ 00092 /* =================== */ 00093 00094 /* THRESH is a threshold value used to decide if scaling should be done */ 00095 /* based on the ratio of the scaling factors. If SCOND < THRESH, */ 00096 /* scaling is done. */ 00097 00098 /* LARGE and SMALL are threshold values used to decide if scaling should */ 00099 /* be done based on the absolute size of the largest matrix element. */ 00100 /* If AMAX > LARGE or AMAX < SMALL, scaling is done. */ 00101 00102 /* ===================================================================== */ 00103 00104 /* .. Parameters .. */ 00105 /* .. */ 00106 /* .. Local Scalars .. */ 00107 /* .. */ 00108 /* .. External Functions .. */ 00109 /* .. */ 00110 /* .. Intrinsic Functions .. */ 00111 /* .. */ 00112 /* .. Executable Statements .. */ 00113 00114 /* Quick return if possible */ 00115 00116 /* Parameter adjustments */ 00117 ab_dim1 = *ldab; 00118 ab_offset = 1 + ab_dim1; 00119 ab -= ab_offset; 00120 --s; 00121 00122 /* Function Body */ 00123 if (*n <= 0) { 00124 *(unsigned char *)equed = 'N'; 00125 return 0; 00126 } 00127 00128 /* Initialize LARGE and SMALL. */ 00129 00130 small = slamch_("Safe minimum") / slamch_("Precision"); 00131 large = 1.f / small; 00132 00133 if (*scond >= .1f && *amax >= small && *amax <= large) { 00134 00135 /* No equilibration */ 00136 00137 *(unsigned char *)equed = 'N'; 00138 } else { 00139 00140 /* Replace A by diag(S) * A * diag(S). */ 00141 00142 if (lsame_(uplo, "U")) { 00143 00144 /* Upper triangle of A is stored in band format. */ 00145 00146 i__1 = *n; 00147 for (j = 1; j <= i__1; ++j) { 00148 cj = s[j]; 00149 /* Computing MAX */ 00150 i__2 = 1, i__3 = j - *kd; 00151 i__4 = j; 00152 for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) { 00153 ab[*kd + 1 + i__ - j + j * ab_dim1] = cj * s[i__] * ab[* 00154 kd + 1 + i__ - j + j * ab_dim1]; 00155 /* L10: */ 00156 } 00157 /* L20: */ 00158 } 00159 } else { 00160 00161 /* Lower triangle of A is stored. */ 00162 00163 i__1 = *n; 00164 for (j = 1; j <= i__1; ++j) { 00165 cj = s[j]; 00166 /* Computing MIN */ 00167 i__2 = *n, i__3 = j + *kd; 00168 i__4 = min(i__2,i__3); 00169 for (i__ = j; i__ <= i__4; ++i__) { 00170 ab[i__ + 1 - j + j * ab_dim1] = cj * s[i__] * ab[i__ + 1 00171 - j + j * ab_dim1]; 00172 /* L30: */ 00173 } 00174 /* L40: */ 00175 } 00176 } 00177 *(unsigned char *)equed = 'Y'; 00178 } 00179 00180 return 0; 00181 00182 /* End of SLAQSB */ 00183 00184 } /* slaqsb_ */