LAPACK 3.12.1
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 121 of file clanhe.f.

122*
123* -- LAPACK auxiliary routine --
124* -- LAPACK is a software package provided by Univ. of Tennessee, --
125* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
126*
127* .. Scalar Arguments ..
128 CHARACTER NORM, UPLO
129 INTEGER LDA, N
130* ..
131* .. Array Arguments ..
132 REAL WORK( * )
133 COMPLEX A( LDA, * )
134* ..
135*
136* =====================================================================
137*
138* .. Parameters ..
139 REAL ONE, ZERO
140 parameter( one = 1.0e+0, zero = 0.0e+0 )
141* ..
142* .. Local Scalars ..
143 INTEGER I, J
144 REAL ABSA, SCALE, SUM, VALUE
145* ..
146* .. External Functions ..
147 LOGICAL LSAME, SISNAN
148 EXTERNAL lsame, sisnan
149* ..
150* .. External Subroutines ..
151 EXTERNAL classq
152* ..
153* .. Intrinsic Functions ..
154 INTRINSIC abs, real, sqrt
155* ..
156* .. Executable Statements ..
157*
158 IF( n.EQ.0 ) THEN
159 VALUE = zero
160 ELSE IF( lsame( norm, 'M' ) ) THEN
161*
162* Find max(abs(A(i,j))).
163*
164 VALUE = zero
165 IF( lsame( uplo, 'U' ) ) THEN
166 DO 20 j = 1, n
167 DO 10 i = 1, j - 1
168 sum = abs( a( i, j ) )
169 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
170 10 CONTINUE
171 sum = abs( real( a( j, j ) ) )
172 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
173 20 CONTINUE
174 ELSE
175 DO 40 j = 1, n
176 sum = abs( real( a( j, j ) ) )
177 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
178 DO 30 i = j + 1, n
179 sum = abs( a( i, j ) )
180 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
181 30 CONTINUE
182 40 CONTINUE
183 END IF
184 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
185 $ ( lsame( norm, 'O' ) ) .OR.
186 $ ( norm.EQ.'1' ) ) THEN
187*
188* Find normI(A) ( = norm1(A), since A is hermitian).
189*
190 VALUE = zero
191 IF( lsame( uplo, 'U' ) ) THEN
192 DO 60 j = 1, n
193 sum = zero
194 DO 50 i = 1, j - 1
195 absa = abs( a( i, j ) )
196 sum = sum + absa
197 work( i ) = work( i ) + absa
198 50 CONTINUE
199 work( j ) = sum + abs( real( a( j, j ) ) )
200 60 CONTINUE
201 DO 70 i = 1, n
202 sum = work( i )
203 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
204 70 CONTINUE
205 ELSE
206 DO 80 i = 1, n
207 work( i ) = zero
208 80 CONTINUE
209 DO 100 j = 1, n
210 sum = work( j ) + abs( real( a( j, j ) ) )
211 DO 90 i = j + 1, n
212 absa = abs( a( i, j ) )
213 sum = sum + absa
214 work( i ) = work( i ) + absa
215 90 CONTINUE
216 IF( VALUE .LT. sum .OR. sisnan( sum ) ) VALUE = sum
217 100 CONTINUE
218 END IF
219 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
220 $ ( 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:57
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:122
subroutine classq(n, x, incx, scale, sumsq)
CLASSQ updates a sum of squares represented in scaled form.
Definition classq.f90:122
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: