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

◆ clanhp()

real function clanhp ( character  norm,
character  uplo,
integer  n,
complex, dimension( * )  ap,
real, dimension( * )  work 
)

CLANHP 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 supplied in packed form.

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

Purpose:
 CLANHP  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,  supplied in packed form.
Returns
CLANHP
    CLANHP = ( 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 CLANHP as described
          above.
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the upper or lower triangular part of the
          hermitian matrix A is supplied.
          = 'U':  Upper triangular part of A is supplied
          = 'L':  Lower triangular part of A is supplied
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.  When N = 0, CLANHP is
          set to zero.
[in]AP
          AP is COMPLEX array, dimension (N*(N+1)/2)
          The upper or lower triangle of the hermitian matrix A, packed
          columnwise in a linear array.  The j-th column of A is stored
          in the array AP as follows:
          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
          Note that the  imaginary parts of the diagonal elements need
          not be set and are assumed to be zero.
[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 116 of file clanhp.f.

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