LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ 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.

Definition at line 123 of file clanhe.f.

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