clangt.c
Go to the documentation of this file.
00001 /* clangt.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 /* Table of constant values */
00017 
00018 static integer c__1 = 1;
00019 
00020 doublereal clangt_(char *norm, integer *n, complex *dl, complex *d__, complex 
00021         *du)
00022 {
00023     /* System generated locals */
00024     integer i__1;
00025     real ret_val, r__1, r__2;
00026 
00027     /* Builtin functions */
00028     double c_abs(complex *), sqrt(doublereal);
00029 
00030     /* Local variables */
00031     integer i__;
00032     real sum, scale;
00033     extern logical lsame_(char *, char *);
00034     real anorm;
00035     extern /* Subroutine */ int classq_(integer *, complex *, integer *, real 
00036             *, real *);
00037 
00038 
00039 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00040 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00041 /*     November 2006 */
00042 
00043 /*     .. Scalar Arguments .. */
00044 /*     .. */
00045 /*     .. Array Arguments .. */
00046 /*     .. */
00047 
00048 /*  Purpose */
00049 /*  ======= */
00050 
00051 /*  CLANGT  returns the value of the one norm,  or the Frobenius norm, or */
00052 /*  the  infinity norm,  or the  element of  largest absolute value  of a */
00053 /*  complex tridiagonal matrix A. */
00054 
00055 /*  Description */
00056 /*  =========== */
00057 
00058 /*  CLANGT returns the value */
00059 
00060 /*     CLANGT = ( max(abs(A(i,j))), NORM = 'M' or 'm' */
00061 /*              ( */
00062 /*              ( norm1(A),         NORM = '1', 'O' or 'o' */
00063 /*              ( */
00064 /*              ( normI(A),         NORM = 'I' or 'i' */
00065 /*              ( */
00066 /*              ( normF(A),         NORM = 'F', 'f', 'E' or 'e' */
00067 
00068 /*  where  norm1  denotes the  one norm of a matrix (maximum column sum), */
00069 /*  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and */
00070 /*  normF  denotes the  Frobenius norm of a matrix (square root of sum of */
00071 /*  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm. */
00072 
00073 /*  Arguments */
00074 /*  ========= */
00075 
00076 /*  NORM    (input) CHARACTER*1 */
00077 /*          Specifies the value to be returned in CLANGT as described */
00078 /*          above. */
00079 
00080 /*  N       (input) INTEGER */
00081 /*          The order of the matrix A.  N >= 0.  When N = 0, CLANGT is */
00082 /*          set to zero. */
00083 
00084 /*  DL      (input) COMPLEX array, dimension (N-1) */
00085 /*          The (n-1) sub-diagonal elements of A. */
00086 
00087 /*  D       (input) COMPLEX array, dimension (N) */
00088 /*          The diagonal elements of A. */
00089 
00090 /*  DU      (input) COMPLEX array, dimension (N-1) */
00091 /*          The (n-1) super-diagonal elements of A. */
00092 
00093 /*  ===================================================================== */
00094 
00095 /*     .. Parameters .. */
00096 /*     .. */
00097 /*     .. Local Scalars .. */
00098 /*     .. */
00099 /*     .. External Functions .. */
00100 /*     .. */
00101 /*     .. External Subroutines .. */
00102 /*     .. */
00103 /*     .. Intrinsic Functions .. */
00104 /*     .. */
00105 /*     .. Executable Statements .. */
00106 
00107     /* Parameter adjustments */
00108     --du;
00109     --d__;
00110     --dl;
00111 
00112     /* Function Body */
00113     if (*n <= 0) {
00114         anorm = 0.f;
00115     } else if (lsame_(norm, "M")) {
00116 
00117 /*        Find max(abs(A(i,j))). */
00118 
00119         anorm = c_abs(&d__[*n]);
00120         i__1 = *n - 1;
00121         for (i__ = 1; i__ <= i__1; ++i__) {
00122 /* Computing MAX */
00123             r__1 = anorm, r__2 = c_abs(&dl[i__]);
00124             anorm = dmax(r__1,r__2);
00125 /* Computing MAX */
00126             r__1 = anorm, r__2 = c_abs(&d__[i__]);
00127             anorm = dmax(r__1,r__2);
00128 /* Computing MAX */
00129             r__1 = anorm, r__2 = c_abs(&du[i__]);
00130             anorm = dmax(r__1,r__2);
00131 /* L10: */
00132         }
00133     } else if (lsame_(norm, "O") || *(unsigned char *)
00134             norm == '1') {
00135 
00136 /*        Find norm1(A). */
00137 
00138         if (*n == 1) {
00139             anorm = c_abs(&d__[1]);
00140         } else {
00141 /* Computing MAX */
00142             r__1 = c_abs(&d__[1]) + c_abs(&dl[1]), r__2 = c_abs(&d__[*n]) + 
00143                     c_abs(&du[*n - 1]);
00144             anorm = dmax(r__1,r__2);
00145             i__1 = *n - 1;
00146             for (i__ = 2; i__ <= i__1; ++i__) {
00147 /* Computing MAX */
00148                 r__1 = anorm, r__2 = c_abs(&d__[i__]) + c_abs(&dl[i__]) + 
00149                         c_abs(&du[i__ - 1]);
00150                 anorm = dmax(r__1,r__2);
00151 /* L20: */
00152             }
00153         }
00154     } else if (lsame_(norm, "I")) {
00155 
00156 /*        Find normI(A). */
00157 
00158         if (*n == 1) {
00159             anorm = c_abs(&d__[1]);
00160         } else {
00161 /* Computing MAX */
00162             r__1 = c_abs(&d__[1]) + c_abs(&du[1]), r__2 = c_abs(&d__[*n]) + 
00163                     c_abs(&dl[*n - 1]);
00164             anorm = dmax(r__1,r__2);
00165             i__1 = *n - 1;
00166             for (i__ = 2; i__ <= i__1; ++i__) {
00167 /* Computing MAX */
00168                 r__1 = anorm, r__2 = c_abs(&d__[i__]) + c_abs(&du[i__]) + 
00169                         c_abs(&dl[i__ - 1]);
00170                 anorm = dmax(r__1,r__2);
00171 /* L30: */
00172             }
00173         }
00174     } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00175 
00176 /*        Find normF(A). */
00177 
00178         scale = 0.f;
00179         sum = 1.f;
00180         classq_(n, &d__[1], &c__1, &scale, &sum);
00181         if (*n > 1) {
00182             i__1 = *n - 1;
00183             classq_(&i__1, &dl[1], &c__1, &scale, &sum);
00184             i__1 = *n - 1;
00185             classq_(&i__1, &du[1], &c__1, &scale, &sum);
00186         }
00187         anorm = scale * sqrt(sum);
00188     }
00189 
00190     ret_val = anorm;
00191     return ret_val;
00192 
00193 /*     End of CLANGT */
00194 
00195 } /* clangt_ */


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