1 *> \brief \b DLANTR returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a trapezoidal or triangular matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download DLANTR + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlantr.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlantr.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlantr.f">
21 * DOUBLE PRECISION FUNCTION DLANTR( NORM, UPLO, DIAG, M, N, A, LDA,
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, NORM, UPLO
28 * .. Array Arguments ..
29 * DOUBLE PRECISION A( LDA, * ), WORK( * )
38 *> DLANTR returns the value of the one norm, or the Frobenius norm, or
39 *> the infinity norm, or the element of largest absolute value of a
40 *> trapezoidal or triangular matrix A.
46 *> DLANTR = ( max(abs(A(i,j))), NORM = 'M' or 'm'
48 *> ( norm1(A), NORM = '1', 'O' or 'o'
50 *> ( normI(A), NORM = 'I' or 'i'
52 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
54 *> where norm1 denotes the one norm of a matrix (maximum column sum),
55 *> normI denotes the infinity norm of a matrix (maximum row sum) and
56 *> normF denotes the Frobenius norm of a matrix (square root of sum of
57 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
65 *> NORM is CHARACTER*1
66 *> Specifies the value to be returned in DLANTR as described
72 *> UPLO is CHARACTER*1
73 *> Specifies whether the matrix A is upper or lower trapezoidal.
74 *> = 'U': Upper trapezoidal
75 *> = 'L': Lower trapezoidal
76 *> Note that A is triangular instead of trapezoidal if M = N.
81 *> DIAG is CHARACTER*1
82 *> Specifies whether or not the matrix A has unit diagonal.
83 *> = 'N': Non-unit diagonal
84 *> = 'U': Unit diagonal
90 *> The number of rows of the matrix A. M >= 0, and if
91 *> UPLO = 'U', M <= N. When M = 0, DLANTR is set to zero.
97 *> The number of columns of the matrix A. N >= 0, and if
98 *> UPLO = 'L', N <= M. When N = 0, DLANTR is set to zero.
103 *> A is DOUBLE PRECISION array, dimension (LDA,N)
104 *> The trapezoidal matrix A (A is triangular if M = N).
105 *> If UPLO = 'U', the leading m by n upper trapezoidal part of
106 *> the array A contains the upper trapezoidal matrix, and the
107 *> strictly lower triangular part of A is not referenced.
108 *> If UPLO = 'L', the leading m by n lower trapezoidal part of
109 *> the array A contains the lower trapezoidal matrix, and the
110 *> strictly upper triangular part of A is not referenced. Note
111 *> that when DIAG = 'U', the diagonal elements of A are not
112 *> referenced and are assumed to be one.
118 *> The leading dimension of the array A. LDA >= max(M,1).
123 *> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
124 *> where LWORK >= M 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 doubleOTHERauxiliary
140 * =====================================================================
141 DOUBLE PRECISION FUNCTION DLANTR( NORM, UPLO, DIAG, M, N, A, LDA,
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 ..
154 DOUBLE PRECISION A( LDA, * ), WORK( * )
157 * =====================================================================
160 DOUBLE PRECISION ONE, ZERO
161 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
163 * .. Local Scalars ..
166 DOUBLE PRECISION SCALE, SUM, VALUE
168 * .. External Subroutines ..
171 * .. External Functions ..
172 LOGICAL LSAME, DISNAN
173 EXTERNAL LSAME, DISNAN
175 * .. Intrinsic Functions ..
176 INTRINSIC ABS, MIN, SQRT
178 * .. Executable Statements ..
180 IF( MIN( M, N ).EQ.0 ) THEN
182 ELSE IF( LSAME( NORM, 'M' ) ) THEN
184 * Find max(abs(A(i,j))).
186 IF( LSAME( DIAG, 'U' ) ) THEN
188 IF( LSAME( UPLO, 'U' ) ) THEN
190 DO 10 I = 1, MIN( M, J-1 )
191 SUM = ABS( A( I, J ) )
192 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
198 SUM = ABS( A( I, J ) )
199 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
205 IF( LSAME( UPLO, 'U' ) ) THEN
207 DO 50 I = 1, MIN( M, J )
208 SUM = ABS( A( I, J ) )
209 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
215 SUM = ABS( A( I, J ) )
216 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
221 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
226 UDIAG = LSAME( DIAG, 'U' )
227 IF( LSAME( UPLO, 'U' ) ) THEN
229 IF( ( UDIAG ) .AND. ( J.LE.M ) ) THEN
232 SUM = SUM + ABS( A( I, J ) )
236 DO 100 I = 1, MIN( M, J )
237 SUM = SUM + ABS( A( I, J ) )
240 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
247 SUM = SUM + ABS( A( I, J ) )
252 SUM = SUM + ABS( A( I, J ) )
255 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
258 ELSE IF( LSAME( NORM, 'I' ) ) THEN
262 IF( LSAME( UPLO, 'U' ) ) THEN
263 IF( LSAME( DIAG, 'U' ) ) THEN
268 DO 160 I = 1, MIN( M, J-1 )
269 WORK( I ) = WORK( I ) + ABS( A( I, J ) )
277 DO 190 I = 1, MIN( M, J )
278 WORK( I ) = WORK( I ) + ABS( A( I, J ) )
283 IF( LSAME( DIAG, 'U' ) ) THEN
292 WORK( I ) = WORK( I ) + ABS( A( I, J ) )
301 WORK( I ) = WORK( I ) + ABS( A( I, J ) )
309 IF( VALUE .LT. SUM .OR. DISNAN( SUM ) ) VALUE = SUM
311 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
315 IF( LSAME( UPLO, 'U' ) ) THEN
316 IF( LSAME( DIAG, 'U' ) ) THEN
320 CALL DLASSQ( MIN( M, J-1 ), A( 1, J ), 1, SCALE, SUM )
326 CALL DLASSQ( MIN( M, J ), A( 1, J ), 1, SCALE, SUM )
330 IF( LSAME( DIAG, 'U' ) ) THEN
334 CALL DLASSQ( M-J, A( MIN( M, J+1 ), J ), 1, SCALE,
341 CALL DLASSQ( M-J+1, A( J, J ), 1, SCALE, SUM )
345 VALUE = SCALE*SQRT( SUM )