zlanht.c
Go to the documentation of this file.
00001 /* zlanht.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 zlanht_(char *norm, integer *n, doublereal *d__, doublecomplex *e)
00021 {
00022     /* System generated locals */
00023     integer i__1;
00024     doublereal ret_val, d__1, d__2, d__3;
00025 
00026     /* Builtin functions */
00027     double z_abs(doublecomplex *), sqrt(doublereal);
00028 
00029     /* Local variables */
00030     integer i__;
00031     doublereal sum, scale;
00032     extern logical lsame_(char *, char *);
00033     doublereal anorm;
00034     extern /* Subroutine */ int dlassq_(integer *, doublereal *, integer *, 
00035             doublereal *, doublereal *), zlassq_(integer *, doublecomplex *, 
00036             integer *, doublereal *, doublereal *);
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 /*  ZLANHT  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 Hermitian tridiagonal matrix A. */
00054 
00055 /*  Description */
00056 /*  =========== */
00057 
00058 /*  ZLANHT returns the value */
00059 
00060 /*     ZLANHT = ( 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 ZLANHT as described */
00078 /*          above. */
00079 
00080 /*  N       (input) INTEGER */
00081 /*          The order of the matrix A.  N >= 0.  When N = 0, ZLANHT is */
00082 /*          set to zero. */
00083 
00084 /*  D       (input) DOUBLE PRECISION array, dimension (N) */
00085 /*          The diagonal elements of A. */
00086 
00087 /*  E       (input) COMPLEX*16 array, dimension (N-1) */
00088 /*          The (n-1) sub-diagonal or super-diagonal elements of A. */
00089 
00090 /*  ===================================================================== */
00091 
00092 /*     .. Parameters .. */
00093 /*     .. */
00094 /*     .. Local Scalars .. */
00095 /*     .. */
00096 /*     .. External Functions .. */
00097 /*     .. */
00098 /*     .. External Subroutines .. */
00099 /*     .. */
00100 /*     .. Intrinsic Functions .. */
00101 /*     .. */
00102 /*     .. Executable Statements .. */
00103 
00104     /* Parameter adjustments */
00105     --e;
00106     --d__;
00107 
00108     /* Function Body */
00109     if (*n <= 0) {
00110         anorm = 0.;
00111     } else if (lsame_(norm, "M")) {
00112 
00113 /*        Find max(abs(A(i,j))). */
00114 
00115         anorm = (d__1 = d__[*n], abs(d__1));
00116         i__1 = *n - 1;
00117         for (i__ = 1; i__ <= i__1; ++i__) {
00118 /* Computing MAX */
00119             d__2 = anorm, d__3 = (d__1 = d__[i__], abs(d__1));
00120             anorm = max(d__2,d__3);
00121 /* Computing MAX */
00122             d__1 = anorm, d__2 = z_abs(&e[i__]);
00123             anorm = max(d__1,d__2);
00124 /* L10: */
00125         }
00126     } else if (lsame_(norm, "O") || *(unsigned char *)
00127             norm == '1' || lsame_(norm, "I")) {
00128 
00129 /*        Find norm1(A). */
00130 
00131         if (*n == 1) {
00132             anorm = abs(d__[1]);
00133         } else {
00134 /* Computing MAX */
00135             d__2 = abs(d__[1]) + z_abs(&e[1]), d__3 = z_abs(&e[*n - 1]) + (
00136                     d__1 = d__[*n], abs(d__1));
00137             anorm = max(d__2,d__3);
00138             i__1 = *n - 1;
00139             for (i__ = 2; i__ <= i__1; ++i__) {
00140 /* Computing MAX */
00141                 d__2 = anorm, d__3 = (d__1 = d__[i__], abs(d__1)) + z_abs(&e[
00142                         i__]) + z_abs(&e[i__ - 1]);
00143                 anorm = max(d__2,d__3);
00144 /* L20: */
00145             }
00146         }
00147     } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00148 
00149 /*        Find normF(A). */
00150 
00151         scale = 0.;
00152         sum = 1.;
00153         if (*n > 1) {
00154             i__1 = *n - 1;
00155             zlassq_(&i__1, &e[1], &c__1, &scale, &sum);
00156             sum *= 2;
00157         }
00158         dlassq_(n, &d__[1], &c__1, &scale, &sum);
00159         anorm = scale * sqrt(sum);
00160     }
00161 
00162     ret_val = anorm;
00163     return ret_val;
00164 
00165 /*     End of ZLANHT */
00166 
00167 } /* zlanht_ */


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