1 *> \brief \b CLANTB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular band matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CLANTB + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clantb.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clantb.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clantb.f">
21 * REAL FUNCTION CLANTB( NORM, UPLO, DIAG, N, K, AB,
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, NORM, UPLO
28 * .. Array Arguments ..
30 * COMPLEX AB( LDAB, * )
39 *> CLANTB returns the value of the one norm, or the Frobenius norm, or
40 *> the infinity norm, or the element of largest absolute value of an
41 *> n by n triangular band matrix A, with ( k + 1 ) diagonals.
47 *> CLANTB = ( max(abs(A(i,j))), NORM = 'M' or 'm'
49 *> ( norm1(A), NORM = '1', 'O' or 'o'
51 *> ( normI(A), NORM = 'I' or 'i'
53 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
55 *> where norm1 denotes the one norm of a matrix (maximum column sum),
56 *> normI denotes the infinity norm of a matrix (maximum row sum) and
57 *> normF denotes the Frobenius norm of a matrix (square root of sum of
58 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
66 *> NORM is CHARACTER*1
67 *> Specifies the value to be returned in CLANTB as described
73 *> UPLO is CHARACTER*1
74 *> Specifies whether the matrix A is upper or lower triangular.
75 *> = 'U': Upper triangular
76 *> = 'L': Lower triangular
81 *> DIAG is CHARACTER*1
82 *> Specifies whether or not the matrix A is unit triangular.
83 *> = 'N': Non-unit triangular
84 *> = 'U': Unit triangular
90 *> The order of the matrix A. N >= 0. When N = 0, CLANTB is
97 *> The number of super-diagonals of the matrix A if UPLO = 'U',
98 *> or the number of sub-diagonals of the matrix A if UPLO = 'L'.
104 *> AB is COMPLEX array, dimension (LDAB,N)
105 *> The upper or lower triangular band matrix A, stored in the
106 *> first k+1 rows of AB. The j-th column of A is stored
107 *> in the j-th column of the array AB as follows:
108 *> if UPLO = 'U', AB(k+1+i-j,j) = A(i,j) for max(1,j-k)<=i<=j;
109 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+k).
110 *> Note that when DIAG = 'U', the elements of the array AB
111 *> corresponding to the diagonal elements of the matrix A are
112 *> not referenced, but are assumed to be one.
118 *> The leading dimension of the array AB. LDAB >= K+1.
123 *> WORK is REAL array, dimension (MAX(1,LWORK)),
124 *> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
131 *> \author Univ. of Tennessee
132 *> \author Univ. of California Berkeley
133 *> \author Univ. of Colorado Denver
136 *> \date September 2012
138 *> \ingroup complexOTHERauxiliary
140 * =====================================================================
141 REAL FUNCTION CLANTB( NORM, UPLO, DIAG, N, K, AB,
144 * -- LAPACK auxiliary routine (version 3.4.2) --
145 * -- LAPACK is a software package provided by Univ. of Tennessee, --
146 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
149 * .. Scalar Arguments ..
150 CHARACTER DIAG, NORM, UPLO
153 * .. Array Arguments ..
155 COMPLEX AB( LDAB, * )
158 * =====================================================================
162 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
164 * .. Local Scalars ..
167 REAL SCALE, SUM, VALUE
169 * .. External Functions ..
170 LOGICAL LSAME, SISNAN
171 EXTERNAL LSAME, SISNAN
173 * .. External Subroutines ..
176 * .. Intrinsic Functions ..
177 INTRINSIC ABS, MAX, MIN, SQRT
179 * .. Executable Statements ..
183 ELSE IF( LSAME( NORM, 'M' ) ) THEN
185 * Find max(abs(A(i,j))).
187 IF( LSAME( DIAG, 'U' ) ) THEN
189 IF( LSAME( UPLO, 'U' ) ) THEN
191 DO 10 I = MAX( K+2-J, 1 ), K
192 SUM = ABS( AB( I, J ) )
193 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
198 DO 30 I = 2, MIN( N+1-J, K+1 )
199 SUM = ABS( AB( I, J ) )
200 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
206 IF( LSAME( UPLO, 'U' ) ) THEN
208 DO 50 I = MAX( K+2-J, 1 ), K + 1
209 SUM = ABS( AB( I, J ) )
210 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
215 DO 70 I = 1, MIN( N+1-J, K+1 )
216 SUM = ABS( AB( I, J ) )
217 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
222 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
227 UDIAG = LSAME( DIAG, 'U' )
228 IF( LSAME( UPLO, 'U' ) ) THEN
232 DO 90 I = MAX( K+2-J, 1 ), K
233 SUM = SUM + ABS( AB( I, J ) )
237 DO 100 I = MAX( K+2-J, 1 ), K + 1
238 SUM = SUM + ABS( AB( I, J ) )
241 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
247 DO 120 I = 2, MIN( N+1-J, K+1 )
248 SUM = SUM + ABS( AB( I, J ) )
252 DO 130 I = 1, MIN( N+1-J, K+1 )
253 SUM = SUM + ABS( AB( I, J ) )
256 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
259 ELSE IF( LSAME( NORM, 'I' ) ) THEN
264 IF( LSAME( UPLO, 'U' ) ) THEN
265 IF( LSAME( DIAG, 'U' ) ) THEN
271 DO 160 I = MAX( 1, J-K ), J - 1
272 WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
281 DO 190 I = MAX( 1, J-K ), J
282 WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
287 IF( LSAME( DIAG, 'U' ) ) THEN
293 DO 220 I = J + 1, MIN( N, J+K )
294 WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
303 DO 250 I = J, MIN( N, J+K )
304 WORK( I ) = WORK( I ) + ABS( AB( L+I, J ) )
311 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
313 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
317 IF( LSAME( UPLO, 'U' ) ) THEN
318 IF( LSAME( DIAG, 'U' ) ) THEN
323 CALL CLASSQ( MIN( J-1, K ),
324 $ AB( MAX( K+2-J, 1 ), J ), 1, SCALE,
332 CALL CLASSQ( MIN( J, K+1 ), AB( MAX( K+2-J, 1 ), J ),
337 IF( LSAME( DIAG, 'U' ) ) THEN
342 CALL CLASSQ( MIN( N-J, K ), AB( 2, J ), 1, SCALE,
350 CALL CLASSQ( MIN( N-J+1, K+1 ), AB( 1, J ), 1, SCALE,
355 VALUE = SCALE*SQRT( SUM )