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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:41