1 *> \brief \b 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.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CLANHP + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clanhp.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clanhp.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clanhp.f">
21 * REAL FUNCTION CLANHP( NORM, UPLO, N, AP, WORK )
23 * .. Scalar Arguments ..
24 * CHARACTER NORM, UPLO
27 * .. Array Arguments ..
38 *> CLANHP returns the value of the one norm, or the Frobenius norm, or
39 *> the infinity norm, or the element of largest absolute value of a
40 *> complex hermitian matrix A, supplied in packed form.
46 *> CLANHP = ( max(abs(A(i,j))), NORM = 'M' or 'm'
48 *> ( norm1(A), NORM = '1', 'O' or 'o'
50 *> ( normI(A), NORM = 'I' or 'i'
52 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
54 *> where norm1 denotes the one norm of a matrix (maximum column sum),
55 *> normI denotes the infinity norm of a matrix (maximum row sum) and
56 *> normF denotes the Frobenius norm of a matrix (square root of sum of
57 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
65 *> NORM is CHARACTER*1
66 *> Specifies the value to be returned in CLANHP as described
72 *> UPLO is CHARACTER*1
73 *> Specifies whether the upper or lower triangular part of the
74 *> hermitian matrix A is supplied.
75 *> = 'U': Upper triangular part of A is supplied
76 *> = 'L': Lower triangular part of A is supplied
82 *> The order of the matrix A. N >= 0. When N = 0, CLANHP is
88 *> AP is COMPLEX array, dimension (N*(N+1)/2)
89 *> The upper or lower triangle of the hermitian matrix A, packed
90 *> columnwise in a linear array. The j-th column of A is stored
91 *> in the array AP as follows:
92 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
93 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
94 *> Note that the imaginary parts of the diagonal elements need
95 *> not be set and are assumed to be zero.
100 *> WORK is REAL array, dimension (MAX(1,LWORK)),
101 *> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
102 *> WORK is not referenced.
108 *> \author Univ. of Tennessee
109 *> \author Univ. of California Berkeley
110 *> \author Univ. of Colorado Denver
113 *> \date September 2012
115 *> \ingroup complexOTHERauxiliary
117 * =====================================================================
118 REAL FUNCTION CLANHP( NORM, UPLO, N, AP, WORK )
120 * -- LAPACK auxiliary routine (version 3.4.2) --
121 * -- LAPACK is a software package provided by Univ. of Tennessee, --
122 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125 * .. Scalar Arguments ..
129 * .. Array Arguments ..
134 * =====================================================================
138 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
140 * .. Local Scalars ..
142 REAL ABSA, SCALE, SUM, VALUE
144 * .. External Functions ..
145 LOGICAL LSAME, SISNAN
146 EXTERNAL LSAME, SISNAN
148 * .. External Subroutines ..
151 * .. Intrinsic Functions ..
152 INTRINSIC ABS, REAL, SQRT
154 * .. Executable Statements ..
158 ELSE IF( LSAME( NORM, 'M' ) ) THEN
160 * Find max(abs(A(i,j))).
163 IF( LSAME( UPLO, 'U' ) ) THEN
166 DO 10 I = K + 1, K + J - 1
168 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
171 SUM = ABS( REAL( AP( K ) ) )
172 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
177 SUM = ABS( REAL( AP( K ) ) )
178 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
179 DO 30 I = K + 1, K + N - J
181 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
186 ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
187 $ ( NORM.EQ.'1' ) ) THEN
189 * Find normI(A) ( = norm1(A), since A is hermitian).
193 IF( LSAME( UPLO, 'U' ) ) THEN
197 ABSA = ABS( AP( K ) )
199 WORK( I ) = WORK( I ) + ABSA
202 WORK( J ) = SUM + ABS( REAL( AP( K ) ) )
207 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
214 SUM = WORK( J ) + ABS( REAL( AP( K ) ) )
217 ABSA = ABS( AP( K ) )
219 WORK( I ) = WORK( I ) + ABSA
222 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
225 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
232 IF( LSAME( UPLO, 'U' ) ) THEN
234 CALL CLASSQ( J-1, AP( K ), 1, SCALE, SUM )
239 CALL CLASSQ( N-J, AP( K ), 1, SCALE, SUM )
246 IF( REAL( AP( K ) ).NE.ZERO ) THEN
247 ABSA = ABS( REAL( AP( K ) ) )
248 IF( SCALE.LT.ABSA ) THEN
249 SUM = ONE + SUM*( SCALE / ABSA )**2
252 SUM = SUM + ( ABSA / SCALE )**2
255 IF( LSAME( UPLO, 'U' ) ) THEN
261 VALUE = SCALE*SQRT( SUM )