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