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


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