1 DOUBLE PRECISION FUNCTION DLANSY( NORM, UPLO, N, A, LDA, WORK )
3 ! -- LAPACK auxiliary routine (version 3.1) --
4 ! Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
7 ! .. Scalar Arguments ..
11 ! .. Array Arguments ..
12 DOUBLE PRECISION A( LDA, * ), WORK( * )
18 ! DLANSY returns the value of the one norm, or the Frobenius norm, or
19 ! the infinity norm, or the element of largest absolute value of a
20 ! real symmetric matrix A.
25 ! DLANSY returns the value
27 ! DLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm'
29 ! ( norm1(A), NORM = '1', 'O' or 'o'
31 ! ( normI(A), NORM = 'I' or 'i'
33 ! ( normF(A), NORM = 'F', 'f', 'E' or 'e'
35 ! where norm1 denotes the one norm of a matrix (maximum column sum),
36 ! normI denotes the infinity norm of a matrix (maximum row sum) and
37 ! normF denotes the Frobenius norm of a matrix (square root of sum of
38 ! squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
43 ! NORM (input) CHARACTER*1
44 ! Specifies the value to be returned in DLANSY as described
47 ! UPLO (input) CHARACTER*1
48 ! Specifies whether the upper or lower triangular part of the
49 ! symmetric matrix A is to be referenced.
50 ! = 'U': Upper triangular part of A is referenced
51 ! = 'L': Lower triangular part of A is referenced
54 ! The order of the matrix A. N >= 0. When N = 0, DLANSY is
57 ! A (input) DOUBLE PRECISION array, dimension (LDA,N)
58 ! The symmetric matrix A. If UPLO = 'U', the leading n by n
59 ! upper triangular part of A contains the upper triangular part
60 ! of the matrix A, and the strictly lower triangular part of A
61 ! is not referenced. If UPLO = 'L', the leading n by n lower
62 ! triangular part of A contains the lower triangular part of
63 ! the matrix A, and the strictly upper triangular part of A is
67 ! The leading dimension of the array A. LDA >= max(N,1).
69 ! WORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
70 ! where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
71 ! WORK is not referenced.
73 ! =====================================================================
76 DOUBLE PRECISION ONE, ZERO
77 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
81 DOUBLE PRECISION ABSA, SCALE, SUM, VALUE
83 ! .. External Subroutines ..
86 ! .. External Functions ..
90 ! .. Intrinsic Functions ..
91 INTRINSIC ABS, MAX, SQRT
93 ! .. Executable Statements ..
97 ELSE IF( LSAME( NORM, 'M' ) ) THEN
99 ! Find max(abs(A(i,j))).
102 IF( LSAME( UPLO, 'U' ) ) THEN
105 VALUE = MAX( VALUE, ABS( A( I, J ) ) )
111 VALUE = MAX( VALUE, ABS( A( I, J ) ) )
115 ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR. &
116 ( NORM.EQ.'1' ) ) THEN
118 ! Find normI(A) ( = norm1(A), since A is symmetric).
121 IF( LSAME( UPLO, 'U' ) ) THEN
125 ABSA = ABS( A( I, J ) )
127 WORK( I ) = WORK( I ) + ABSA
129 WORK( J ) = SUM + ABS( A( J, J ) )
132 VALUE = MAX( VALUE, WORK( I ) )
139 SUM = WORK( J ) + ABS( A( J, J ) )
141 ABSA = ABS( A( I, J ) )
143 WORK( I ) = WORK( I ) + ABSA
145 VALUE = MAX( VALUE, SUM )
148 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
154 IF( LSAME( UPLO, 'U' ) ) THEN
156 CALL DLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
160 CALL DLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
164 CALL DLASSQ( N, A, LDA+1, SCALE, SUM )
165 VALUE = SCALE*SQRT( SUM )