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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:46