```001:       DOUBLE PRECISION FUNCTION DLANGT( NORM, N, DL, D, DU )
002: *
003: *  -- LAPACK auxiliary routine (version 3.2) --
004: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
005: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
006: *     November 2006
007: *
008: *     .. Scalar Arguments ..
009:       CHARACTER          NORM
010:       INTEGER            N
011: *     ..
012: *     .. Array Arguments ..
013:       DOUBLE PRECISION   D( * ), DL( * ), DU( * )
014: *     ..
015: *
016: *  Purpose
017: *  =======
018: *
019: *  DLANGT  returns the value of the one norm,  or the Frobenius norm, or
020: *  the  infinity norm,  or the  element of  largest absolute value  of a
021: *  real tridiagonal matrix A.
022: *
023: *  Description
024: *  ===========
025: *
026: *  DLANGT returns the value
027: *
028: *     DLANGT = ( max(abs(A(i,j))), NORM = 'M' or 'm'
029: *              (
030: *              ( norm1(A),         NORM = '1', 'O' or 'o'
031: *              (
032: *              ( normI(A),         NORM = 'I' or 'i'
033: *              (
034: *              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
035: *
036: *  where  norm1  denotes the  one norm of a matrix (maximum column sum),
037: *  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
038: *  normF  denotes the  Frobenius norm of a matrix (square root of sum of
039: *  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
040: *
041: *  Arguments
042: *  =========
043: *
044: *  NORM    (input) CHARACTER*1
045: *          Specifies the value to be returned in DLANGT as described
046: *          above.
047: *
048: *  N       (input) INTEGER
049: *          The order of the matrix A.  N >= 0.  When N = 0, DLANGT is
050: *          set to zero.
051: *
052: *  DL      (input) DOUBLE PRECISION array, dimension (N-1)
053: *          The (n-1) sub-diagonal elements of A.
054: *
055: *  D       (input) DOUBLE PRECISION array, dimension (N)
056: *          The diagonal elements of A.
057: *
058: *  DU      (input) DOUBLE PRECISION array, dimension (N-1)
059: *          The (n-1) super-diagonal elements of A.
060: *
061: *  =====================================================================
062: *
063: *     .. Parameters ..
064:       DOUBLE PRECISION   ONE, ZERO
065:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
066: *     ..
067: *     .. Local Scalars ..
068:       INTEGER            I
069:       DOUBLE PRECISION   ANORM, SCALE, SUM
070: *     ..
071: *     .. External Functions ..
072:       LOGICAL            LSAME
073:       EXTERNAL           LSAME
074: *     ..
075: *     .. External Subroutines ..
076:       EXTERNAL           DLASSQ
077: *     ..
078: *     .. Intrinsic Functions ..
079:       INTRINSIC          ABS, MAX, SQRT
080: *     ..
081: *     .. Executable Statements ..
082: *
083:       IF( N.LE.0 ) THEN
084:          ANORM = ZERO
085:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
086: *
087: *        Find max(abs(A(i,j))).
088: *
089:          ANORM = ABS( D( N ) )
090:          DO 10 I = 1, N - 1
091:             ANORM = MAX( ANORM, ABS( DL( I ) ) )
092:             ANORM = MAX( ANORM, ABS( D( I ) ) )
093:             ANORM = MAX( ANORM, ABS( DU( I ) ) )
094:    10    CONTINUE
095:       ELSE IF( LSAME( NORM, 'O' ) .OR. NORM.EQ.'1' ) THEN
096: *
097: *        Find norm1(A).
098: *
099:          IF( N.EQ.1 ) THEN
100:             ANORM = ABS( D( 1 ) )
101:          ELSE
102:             ANORM = MAX( ABS( D( 1 ) )+ABS( DL( 1 ) ),
103:      \$              ABS( D( N ) )+ABS( DU( N-1 ) ) )
104:             DO 20 I = 2, N - 1
105:                ANORM = MAX( ANORM, ABS( D( I ) )+ABS( DL( I ) )+
106:      \$                 ABS( DU( I-1 ) ) )
107:    20       CONTINUE
108:          END IF
109:       ELSE IF( LSAME( NORM, 'I' ) ) THEN
110: *
111: *        Find normI(A).
112: *
113:          IF( N.EQ.1 ) THEN
114:             ANORM = ABS( D( 1 ) )
115:          ELSE
116:             ANORM = MAX( ABS( D( 1 ) )+ABS( DU( 1 ) ),
117:      \$              ABS( D( N ) )+ABS( DL( N-1 ) ) )
118:             DO 30 I = 2, N - 1
119:                ANORM = MAX( ANORM, ABS( D( I ) )+ABS( DU( I ) )+
120:      \$                 ABS( DL( I-1 ) ) )
121:    30       CONTINUE
122:          END IF
123:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
124: *
125: *        Find normF(A).
126: *
127:          SCALE = ZERO
128:          SUM = ONE
129:          CALL DLASSQ( N, D, 1, SCALE, SUM )
130:          IF( N.GT.1 ) THEN
131:             CALL DLASSQ( N-1, DL, 1, SCALE, SUM )
132:             CALL DLASSQ( N-1, DU, 1, SCALE, SUM )
133:          END IF
134:          ANORM = SCALE*SQRT( SUM )
135:       END IF
136: *
137:       DLANGT = ANORM
138:       RETURN
139: *
140: *     End of DLANGT
141: *
142:       END
143: ```