dlangt.c
Go to the documentation of this file.
00001 /* dlangt.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 dlangt_(char *norm, integer *n, doublereal *dl, doublereal *d__, 
00021         doublereal *du)
00022 {
00023     /* System generated locals */
00024     integer i__1;
00025     doublereal ret_val, d__1, d__2, d__3, d__4, d__5;
00026 
00027     /* Builtin functions */
00028     double sqrt(doublereal);
00029 
00030     /* Local variables */
00031     integer i__;
00032     doublereal sum, scale;
00033     extern logical lsame_(char *, char *);
00034     doublereal anorm;
00035     extern /* Subroutine */ int dlassq_(integer *, doublereal *, integer *, 
00036             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 /*  DLANGT  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 /*  real tridiagonal matrix A. */
00054 
00055 /*  Description */
00056 /*  =========== */
00057 
00058 /*  DLANGT returns the value */
00059 
00060 /*     DLANGT = ( 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 DLANGT as described */
00078 /*          above. */
00079 
00080 /*  N       (input) INTEGER */
00081 /*          The order of the matrix A.  N >= 0.  When N = 0, DLANGT is */
00082 /*          set to zero. */
00083 
00084 /*  DL      (input) DOUBLE PRECISION array, dimension (N-1) */
00085 /*          The (n-1) sub-diagonal elements of A. */
00086 
00087 /*  D       (input) DOUBLE PRECISION array, dimension (N) */
00088 /*          The diagonal elements of A. */
00089 
00090 /*  DU      (input) DOUBLE PRECISION 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.;
00115     } else if (lsame_(norm, "M")) {
00116 
00117 /*        Find max(abs(A(i,j))). */
00118 
00119         anorm = (d__1 = d__[*n], abs(d__1));
00120         i__1 = *n - 1;
00121         for (i__ = 1; i__ <= i__1; ++i__) {
00122 /* Computing MAX */
00123             d__2 = anorm, d__3 = (d__1 = dl[i__], abs(d__1));
00124             anorm = max(d__2,d__3);
00125 /* Computing MAX */
00126             d__2 = anorm, d__3 = (d__1 = d__[i__], abs(d__1));
00127             anorm = max(d__2,d__3);
00128 /* Computing MAX */
00129             d__2 = anorm, d__3 = (d__1 = du[i__], abs(d__1));
00130             anorm = max(d__2,d__3);
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 = abs(d__[1]);
00140         } else {
00141 /* Computing MAX */
00142             d__3 = abs(d__[1]) + abs(dl[1]), d__4 = (d__1 = d__[*n], abs(d__1)
00143                     ) + (d__2 = du[*n - 1], abs(d__2));
00144             anorm = max(d__3,d__4);
00145             i__1 = *n - 1;
00146             for (i__ = 2; i__ <= i__1; ++i__) {
00147 /* Computing MAX */
00148                 d__4 = anorm, d__5 = (d__1 = d__[i__], abs(d__1)) + (d__2 = 
00149                         dl[i__], abs(d__2)) + (d__3 = du[i__ - 1], abs(d__3));
00150                 anorm = max(d__4,d__5);
00151 /* L20: */
00152             }
00153         }
00154     } else if (lsame_(norm, "I")) {
00155 
00156 /*        Find normI(A). */
00157 
00158         if (*n == 1) {
00159             anorm = abs(d__[1]);
00160         } else {
00161 /* Computing MAX */
00162             d__3 = abs(d__[1]) + abs(du[1]), d__4 = (d__1 = d__[*n], abs(d__1)
00163                     ) + (d__2 = dl[*n - 1], abs(d__2));
00164             anorm = max(d__3,d__4);
00165             i__1 = *n - 1;
00166             for (i__ = 2; i__ <= i__1; ++i__) {
00167 /* Computing MAX */
00168                 d__4 = anorm, d__5 = (d__1 = d__[i__], abs(d__1)) + (d__2 = 
00169                         du[i__], abs(d__2)) + (d__3 = dl[i__ - 1], abs(d__3));
00170                 anorm = max(d__4,d__5);
00171 /* L30: */
00172             }
00173         }
00174     } else if (lsame_(norm, "F") || lsame_(norm, "E")) {
00175 
00176 /*        Find normF(A). */
00177 
00178         scale = 0.;
00179         sum = 1.;
00180         dlassq_(n, &d__[1], &c__1, &scale, &sum);
00181         if (*n > 1) {
00182             i__1 = *n - 1;
00183             dlassq_(&i__1, &dl[1], &c__1, &scale, &sum);
00184             i__1 = *n - 1;
00185             dlassq_(&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 DLANGT */
00194 
00195 } /* dlangt_ */


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