LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ clanhe()

real function clanhe ( character  NORM,
character  UPLO,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  WORK 
)

CLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian matrix.

Download CLANHE + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 CLANHE  returns the value of the one norm,  or the Frobenius norm, or
 the  infinity norm,  or the  element of  largest absolute value  of a
 complex hermitian matrix A.
Returns
CLANHE
    CLANHE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
             (
             ( norm1(A),         NORM = '1', 'O' or 'o'
             (
             ( normI(A),         NORM = 'I' or 'i'
             (
             ( normF(A),         NORM = 'F', 'f', 'E' or 'e'

 where  norm1  denotes the  one norm of a matrix (maximum column sum),
 normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
 normF  denotes the  Frobenius norm of a matrix (square root of sum of
 squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
Parameters
[in]NORM
          NORM is CHARACTER*1
          Specifies the value to be returned in CLANHE as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          hermitian matrix A is to be referenced.
          = 'U':  Upper triangular part of A is referenced
          = 'L':  Lower triangular part of A is referenced
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, CLANHE is
          set to zero.
[in]A
          A is COMPLEX array, dimension (LDA,N)
          The hermitian matrix A.  If UPLO = 'U', the leading n by n
          upper triangular part of A contains the upper triangular part
          of the matrix A, and the strictly lower triangular part of A
          is not referenced.  If UPLO = 'L', the leading n by n lower
          triangular part of A contains the lower triangular part of
          the matrix A, and the strictly upper triangular part of A is
          not referenced. Note that the imaginary parts of the diagonal
          elements need not be set and are assumed to be zero.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(N,1).
[out]WORK
          WORK is REAL array, dimension (MAX(1,LWORK)),
          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
          WORK is not referenced.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 126 of file clanhe.f.

126 *
127 * -- LAPACK auxiliary routine (version 3.7.0) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
130 * December 2016
131 *
132 * .. Scalar Arguments ..
133  CHARACTER norm, uplo
134  INTEGER lda, n
135 * ..
136 * .. Array Arguments ..
137  REAL work( * )
138  COMPLEX a( lda, * )
139 * ..
140 *
141 * =====================================================================
142 *
143 * .. Parameters ..
144  REAL one, zero
145  parameter( one = 1.0e+0, zero = 0.0e+0 )
146 * ..
147 * .. Local Scalars ..
148  INTEGER i, j
149  REAL absa, scale, sum, value
150 * ..
151 * .. External Functions ..
152  LOGICAL lsame, sisnan
153  EXTERNAL lsame, sisnan
154 * ..
155 * .. External Subroutines ..
156  EXTERNAL classq
157 * ..
158 * .. Intrinsic Functions ..
159  INTRINSIC abs, REAL, sqrt
160 * ..
161 * .. Executable Statements ..
162 *
163  IF( n.EQ.0 ) THEN
164  VALUE = zero
165  ELSE IF( lsame( norm, 'M' ) ) THEN
166 *
167 * Find max(abs(A(i,j))).
168 *
169  VALUE = zero
170  IF( lsame( uplo, 'U' ) ) THEN
171  DO 20 j = 1, n
172  DO 10 i = 1, j - 1
173  sum = abs( a( i, j ) )
174  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
175  10 CONTINUE
176  sum = abs( REAL( A( J, J ) ) )
177  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
178  20 CONTINUE
179  ELSE
180  DO 40 j = 1, n
181  sum = abs( REAL( A( J, J ) ) )
182  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
183  DO 30 i = j + 1, n
184  sum = abs( a( i, j ) )
185  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
186  30 CONTINUE
187  40 CONTINUE
188  END IF
189  ELSE IF( ( lsame( norm, 'I' ) ) .OR. ( lsame( norm, 'O' ) ) .OR.
190  $ ( norm.EQ.'1' ) ) THEN
191 *
192 * Find normI(A) ( = norm1(A), since A is hermitian).
193 *
194  VALUE = zero
195  IF( lsame( uplo, 'U' ) ) THEN
196  DO 60 j = 1, n
197  sum = zero
198  DO 50 i = 1, j - 1
199  absa = abs( a( i, j ) )
200  sum = sum + absa
201  work( i ) = work( i ) + absa
202  50 CONTINUE
203  work( j ) = sum + abs( REAL( A( J, J ) ) )
204  60 CONTINUE
205  DO 70 i = 1, n
206  sum = work( i )
207  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
208  70 CONTINUE
209  ELSE
210  DO 80 i = 1, n
211  work( i ) = zero
212  80 CONTINUE
213  DO 100 j = 1, n
214  sum = work( j ) + abs( REAL( A( J, J ) ) )
215  DO 90 i = j + 1, n
216  absa = abs( a( i, j ) )
217  sum = sum + absa
218  work( i ) = work( i ) + absa
219  90 CONTINUE
220  IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
221  100 CONTINUE
222  END IF
223  ELSE IF( ( lsame( norm, 'F' ) ) .OR. ( lsame( norm, 'E' ) ) ) THEN
224 *
225 * Find normF(A).
226 *
227  scale = zero
228  sum = one
229  IF( lsame( uplo, 'U' ) ) THEN
230  DO 110 j = 2, n
231  CALL classq( j-1, a( 1, j ), 1, scale, sum )
232  110 CONTINUE
233  ELSE
234  DO 120 j = 1, n - 1
235  CALL classq( n-j, a( j+1, j ), 1, scale, sum )
236  120 CONTINUE
237  END IF
238  sum = 2*sum
239  DO 130 i = 1, n
240  IF( REAL( A( I, I ) ).NE.zero ) then
241  absa = abs( REAL( A( I, I ) ) )
242  IF( scale.LT.absa ) THEN
243  sum = one + sum*( scale / absa )**2
244  scale = absa
245  ELSE
246  sum = sum + ( absa / scale )**2
247  END IF
248  END IF
249  130 CONTINUE
250  VALUE = scale*sqrt( sum )
251  END IF
252 *
253  clanhe = VALUE
254  RETURN
255 *
256 * End of CLANHE
257 *
subroutine classq(N, X, INCX, SCALE, SUMSQ)
CLASSQ updates a sum of squares represented in scaled form.
Definition: classq.f:108
logical function sisnan(SIN)
SISNAN tests input for NaN.
Definition: sisnan.f:61
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
real function clanhe(NORM, UPLO, N, A, LDA, WORK)
CLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian matrix.
Definition: clanhe.f:126
Here is the call graph for this function:
Here is the caller graph for this function: