zlaqsy.c
Go to the documentation of this file.
00001 /* zlaqsy.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 zlaqsy_(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 /*  ZLAQSY equilibrates a symmetric 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 /*          symmetric 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 symmetric 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 /*     .. Executable Statements .. */
00110 
00111 /*     Quick return if possible */
00112 
00113     /* Parameter adjustments */
00114     a_dim1 = *lda;
00115     a_offset = 1 + a_dim1;
00116     a -= a_offset;
00117     --s;
00118 
00119     /* Function Body */
00120     if (*n <= 0) {
00121         *(unsigned char *)equed = 'N';
00122         return 0;
00123     }
00124 
00125 /*     Initialize LARGE and SMALL. */
00126 
00127     small = dlamch_("Safe minimum") / dlamch_("Precision");
00128     large = 1. / small;
00129 
00130     if (*scond >= .1 && *amax >= small && *amax <= large) {
00131 
00132 /*        No equilibration */
00133 
00134         *(unsigned char *)equed = 'N';
00135     } else {
00136 
00137 /*        Replace A by diag(S) * A * diag(S). */
00138 
00139         if (lsame_(uplo, "U")) {
00140 
00141 /*           Upper triangle of A is stored. */
00142 
00143             i__1 = *n;
00144             for (j = 1; j <= i__1; ++j) {
00145                 cj = s[j];
00146                 i__2 = j;
00147                 for (i__ = 1; i__ <= i__2; ++i__) {
00148                     i__3 = i__ + j * a_dim1;
00149                     d__1 = cj * s[i__];
00150                     i__4 = i__ + j * a_dim1;
00151                     z__1.r = d__1 * a[i__4].r, z__1.i = d__1 * a[i__4].i;
00152                     a[i__3].r = z__1.r, a[i__3].i = z__1.i;
00153 /* L10: */
00154                 }
00155 /* L20: */
00156             }
00157         } else {
00158 
00159 /*           Lower triangle of A is stored. */
00160 
00161             i__1 = *n;
00162             for (j = 1; j <= i__1; ++j) {
00163                 cj = s[j];
00164                 i__2 = *n;
00165                 for (i__ = j; i__ <= i__2; ++i__) {
00166                     i__3 = i__ + j * a_dim1;
00167                     d__1 = cj * s[i__];
00168                     i__4 = i__ + j * a_dim1;
00169                     z__1.r = d__1 * a[i__4].r, z__1.i = d__1 * a[i__4].i;
00170                     a[i__3].r = z__1.r, a[i__3].i = z__1.i;
00171 /* L30: */
00172                 }
00173 /* L40: */
00174             }
00175         }
00176         *(unsigned char *)equed = 'Y';
00177     }
00178 
00179     return 0;
00180 
00181 /*     End of ZLAQSY */
00182 
00183 } /* zlaqsy_ */


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