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

◆ zlanhp()

double precision function zlanhp ( character norm,
character uplo,
integer n,
complex*16, dimension( * ) ap,
double precision, dimension( * ) work )

ZLANHP 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 ZLANHP + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> ZLANHP  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
ZLANHP
!>
!>    ZLANHP = ( 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 ZLANHP 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, ZLANHP is
!>          set to zero.
!> 
[in]AP
!>          AP is COMPLEX*16 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 DOUBLE PRECISION 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 114 of file zlanhp.f.

115*
116* -- LAPACK auxiliary routine --
117* -- LAPACK is a software package provided by Univ. of Tennessee, --
118* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
119*
120* .. Scalar Arguments ..
121 CHARACTER NORM, UPLO
122 INTEGER N
123* ..
124* .. Array Arguments ..
125 DOUBLE PRECISION WORK( * )
126 COMPLEX*16 AP( * )
127* ..
128*
129* =====================================================================
130*
131* .. Parameters ..
132 DOUBLE PRECISION ONE, ZERO
133 parameter( one = 1.0d+0, zero = 0.0d+0 )
134* ..
135* .. Local Scalars ..
136 INTEGER I, J, K
137 DOUBLE PRECISION ABSA, SCALE, SUM, VALUE
138* ..
139* .. External Functions ..
140 LOGICAL LSAME, DISNAN
141 EXTERNAL lsame, disnan
142* ..
143* .. External Subroutines ..
144 EXTERNAL zlassq
145* ..
146* .. Intrinsic Functions ..
147 INTRINSIC abs, dble, sqrt
148* ..
149* .. Executable Statements ..
150*
151 IF( n.EQ.0 ) THEN
152 VALUE = zero
153 ELSE IF( lsame( norm, 'M' ) ) THEN
154*
155* Find max(abs(A(i,j))).
156*
157 VALUE = zero
158 IF( lsame( uplo, 'U' ) ) THEN
159 k = 0
160 DO 20 j = 1, n
161 DO 10 i = k + 1, k + j - 1
162 sum = abs( ap( i ) )
163 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
164 10 CONTINUE
165 k = k + j
166 sum = abs( dble( ap( k ) ) )
167 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
168 20 CONTINUE
169 ELSE
170 k = 1
171 DO 40 j = 1, n
172 sum = abs( dble( ap( k ) ) )
173 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
174 DO 30 i = k + 1, k + n - j
175 sum = abs( ap( i ) )
176 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
177 30 CONTINUE
178 k = k + n - j + 1
179 40 CONTINUE
180 END IF
181 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
182 $ ( lsame( norm, 'O' ) ) .OR.
183 $ ( norm.EQ.'1' ) ) THEN
184*
185* Find normI(A) ( = norm1(A), since A is hermitian).
186*
187 VALUE = zero
188 k = 1
189 IF( lsame( uplo, 'U' ) ) THEN
190 DO 60 j = 1, n
191 sum = zero
192 DO 50 i = 1, j - 1
193 absa = abs( ap( k ) )
194 sum = sum + absa
195 work( i ) = work( i ) + absa
196 k = k + 1
197 50 CONTINUE
198 work( j ) = sum + abs( dble( ap( k ) ) )
199 k = k + 1
200 60 CONTINUE
201 DO 70 i = 1, n
202 sum = work( i )
203 IF( VALUE .LT. sum .OR. disnan( 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( dble( ap( k ) ) )
211 k = k + 1
212 DO 90 i = j + 1, n
213 absa = abs( ap( k ) )
214 sum = sum + absa
215 work( i ) = work( i ) + absa
216 k = k + 1
217 90 CONTINUE
218 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
219 100 CONTINUE
220 END IF
221 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
222 $ ( 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 zlassq( 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 zlassq( 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( dble( ap( k ) ).NE.zero ) THEN
244 absa = abs( dble( 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 zlanhp = VALUE
262 RETURN
263*
264* End of ZLANHP
265*
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlanhp(norm, uplo, n, ap, work)
ZLANHP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlanhp.f:115
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.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: