1 DOUBLE PRECISION FUNCTION ZLANHP
( NORM
, UPLO
, N
, AP
, WORK
)
3 * -- LAPACK auxiliary routine
(version
3.1) --
4 * Univ
. of Tennessee
, Univ
. of California Berkeley and NAG Ltd
..
7 * .. Scalar Arguments
..
11 * .. Array Arguments
..
12 DOUBLE PRECISION WORK
( * )
19 * ZLANHP returns the value of the one norm
, or the Frobenius norm
, or
20 * the infinity norm
, or the element of largest absolute value of a
21 * complex hermitian matrix A
, supplied in packed form
.
26 * ZLANHP returns the value
28 * ZLANHP
= ( max
(abs
(A
(i
,j
))), NORM
= 'M' or
'm'
30 * ( norm1
(A
), NORM
= '1', 'O' or
'o'
32 * ( normI
(A
), NORM
= 'I' or
'i'
34 * ( normF
(A
), NORM
= 'F', 'f', 'E' or
'e'
36 * where norm1 denotes the one norm of a matrix
(maximum column sum
),
37 * normI denotes the infinity norm of a matrix
(maximum row sum
) and
38 * normF denotes the Frobenius norm of a matrix
(square root of sum of
39 * squares
). Note that max
(abs
(A
(i
,j
))) is not a consistent matrix norm
.
44 * NORM
(input
) CHARACTER*1
45 * Specifies the value
to be returned in ZLANHP as described
48 * UPLO
(input
) CHARACTER*1
49 * Specifies whether the upper or lower triangular part of the
50 * hermitian matrix A is supplied
.
51 * = 'U': Upper triangular part of A is supplied
52 * = 'L': Lower triangular part of A is supplied
55 * The order of the matrix A
. N
>= 0. When N
= 0, ZLANHP is
58 * AP
(input
) COMPLEX*16 array
, dimension (N*
(N
+1)/2)
59 * The upper or lower triangle of the hermitian matrix A
, packed
60 * columnwise in a linear array
. The j
-th column of A is stored
61 * in the array AP as follows
:
62 * if UPLO
= 'U', AP
(i
+ (j
-1)*j
/2) = A
(i
,j
) for 1<=i
<=j
;
63 * if UPLO
= 'L', AP
(i
+ (j
-1)*(2n
-j
)/2) = A
(i
,j
) for j
<=i
<=n
.
64 * Note that the imaginary parts of the diagonal elements need
65 * not be set and are assumed
to be zero
.
67 * WORK
(workspace
) DOUBLE PRECISION array
, dimension (MAX
(1,LWORK
)),
68 * where LWORK
>= N when NORM
= 'I' or
'1' or
'O'; otherwise
,
69 * WORK is not referenced
.
71 * =====================================================================
74 DOUBLE PRECISION ONE
, ZERO
75 PARAMETER ( ONE
= 1.0D
+0, ZERO
= 0.0D
+0 )
79 DOUBLE PRECISION ABSA
, SCALE
, SUM
, VALUE
81 * .. External Functions
..
85 * .. External Subroutines
..
88 * .. Intrinsic Functions
..
89 INTRINSIC ABS
, DBLE
, MAX
, SQRT
91 * .. Executable Statements
..
95 ELSE IF( LSAME
( NORM
, 'M' ) ) THEN
97 * Find max
(abs
(A
(i
,j
))).
100 IF( LSAME
( UPLO
, 'U' ) ) THEN
103 DO 10 I
= K
+ 1, K
+ J
- 1
104 VALUE
= MAX
( VALUE
, ABS
( AP
( I
) ) )
107 VALUE
= MAX
( VALUE
, ABS
( DBLE
( AP
( K
) ) ) )
112 VALUE
= MAX
( VALUE
, ABS
( DBLE
( AP
( K
) ) ) )
113 DO 30 I
= K
+ 1, K
+ N
- J
114 VALUE
= MAX
( VALUE
, ABS
( AP
( I
) ) )
119 ELSE IF( ( LSAME
( NORM
, 'I' ) ) .OR
. ( LSAME
( NORM
, 'O' ) ) .OR
.
120 $
( NORM
.EQ
.'1' ) ) THEN
122 * Find normI
(A
) ( = norm1
(A
), since A is hermitian
).
126 IF( LSAME
( UPLO
, 'U' ) ) THEN
130 ABSA
= ABS
( AP
( K
) )
132 WORK
( I
) = WORK
( I
) + ABSA
135 WORK
( J
) = SUM
+ ABS
( DBLE
( AP
( K
) ) )
139 VALUE
= MAX
( VALUE
, WORK
( I
) )
146 SUM
= WORK
( J
) + ABS
( DBLE
( AP
( K
) ) )
149 ABSA
= ABS
( AP
( K
) )
151 WORK
( I
) = WORK
( I
) + ABSA
154 VALUE
= MAX
( VALUE
, SUM
)
157 ELSE IF( ( LSAME
( NORM
, 'F' ) ) .OR
. ( LSAME
( NORM
, 'E' ) ) ) THEN
164 IF( LSAME
( UPLO
, 'U' ) ) THEN
166 CALL ZLASSQ
( J
-1, AP
( K
), 1, SCALE
, SUM
)
171 CALL ZLASSQ
( N
-J
, AP
( K
), 1, SCALE
, SUM
)
178 IF( DBLE
( AP
( K
) ).NE
.ZERO
) THEN
179 ABSA
= ABS
( DBLE
( AP
( K
) ) )
180 IF( SCALE
.LT
.ABSA
) THEN
181 SUM
= ONE
+ SUM*
( SCALE
/ ABSA
)**2
184 SUM
= SUM
+ ( ABSA
/ SCALE
)**2
187 IF( LSAME
( UPLO
, 'U' ) ) THEN
193 VALUE
= SCALE*SQRT
( SUM
)