LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlanhs.f
Go to the documentation of this file.
1*> \brief \b ZLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value of any element of an upper Hessenberg matrix.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLANHS + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhs.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhs.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhs.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION ZLANHS( NORM, N, A, LDA, WORK )
20*
21* .. Scalar Arguments ..
22* CHARACTER NORM
23* INTEGER LDA, N
24* ..
25* .. Array Arguments ..
26* DOUBLE PRECISION WORK( * )
27* COMPLEX*16 A( LDA, * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> ZLANHS returns the value of the one norm, or the Frobenius norm, or
37*> the infinity norm, or the element of largest absolute value of a
38*> Hessenberg matrix A.
39*> \endverbatim
40*>
41*> \return ZLANHS
42*> \verbatim
43*>
44*> ZLANHS = ( max(abs(A(i,j))), NORM = 'M' or 'm'
45*> (
46*> ( norm1(A), NORM = '1', 'O' or 'o'
47*> (
48*> ( normI(A), NORM = 'I' or 'i'
49*> (
50*> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
51*>
52*> where norm1 denotes the one norm of a matrix (maximum column sum),
53*> normI denotes the infinity norm of a matrix (maximum row sum) and
54*> normF denotes the Frobenius norm of a matrix (square root of sum of
55*> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
56*> \endverbatim
57*
58* Arguments:
59* ==========
60*
61*> \param[in] NORM
62*> \verbatim
63*> NORM is CHARACTER*1
64*> Specifies the value to be returned in ZLANHS as described
65*> above.
66*> \endverbatim
67*>
68*> \param[in] N
69*> \verbatim
70*> N is INTEGER
71*> The order of the matrix A. N >= 0. When N = 0, ZLANHS is
72*> set to zero.
73*> \endverbatim
74*>
75*> \param[in] A
76*> \verbatim
77*> A is COMPLEX*16 array, dimension (LDA,N)
78*> The n by n upper Hessenberg matrix A; the part of A below the
79*> first sub-diagonal is not referenced.
80*> \endverbatim
81*>
82*> \param[in] LDA
83*> \verbatim
84*> LDA is INTEGER
85*> The leading dimension of the array A. LDA >= max(N,1).
86*> \endverbatim
87*>
88*> \param[out] WORK
89*> \verbatim
90*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
91*> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
92*> referenced.
93*> \endverbatim
94*
95* Authors:
96* ========
97*
98*> \author Univ. of Tennessee
99*> \author Univ. of California Berkeley
100*> \author Univ. of Colorado Denver
101*> \author NAG Ltd.
102*
103*> \ingroup lanhs
104*
105* =====================================================================
106 DOUBLE PRECISION FUNCTION zlanhs( NORM, N, A, LDA, WORK )
107*
108* -- LAPACK auxiliary routine --
109* -- LAPACK is a software package provided by Univ. of Tennessee, --
110* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
111*
112* .. Scalar Arguments ..
113 CHARACTER norm
114 INTEGER lda, n
115* ..
116* .. Array Arguments ..
117 DOUBLE PRECISION work( * )
118 COMPLEX*16 a( lda, * )
119* ..
120*
121* =====================================================================
122*
123* .. Parameters ..
124 DOUBLE PRECISION one, zero
125 parameter( one = 1.0d+0, zero = 0.0d+0 )
126* ..
127* .. Local Scalars ..
128 INTEGER i, j
129 DOUBLE PRECISION scale, sum, value
130* ..
131* .. External Functions ..
132 LOGICAL lsame, disnan
133 EXTERNAL lsame, disnan
134* ..
135* .. External Subroutines ..
136 EXTERNAL zlassq
137* ..
138* .. Intrinsic Functions ..
139 INTRINSIC abs, min, sqrt
140* ..
141* .. Executable Statements ..
142*
143 IF( n.EQ.0 ) THEN
144 VALUE = zero
145 ELSE IF( lsame( norm, 'M' ) ) THEN
146*
147* Find max(abs(A(i,j))).
148*
149 VALUE = zero
150 DO 20 j = 1, n
151 DO 10 i = 1, min( n, j+1 )
152 sum = abs( a( i, j ) )
153 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
154 10 CONTINUE
155 20 CONTINUE
156 ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
157*
158* Find norm1(A).
159*
160 VALUE = zero
161 DO 40 j = 1, n
162 sum = zero
163 DO 30 i = 1, min( n, j+1 )
164 sum = sum + abs( a( i, j ) )
165 30 CONTINUE
166 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
167 40 CONTINUE
168 ELSE IF( lsame( norm, 'I' ) ) THEN
169*
170* Find normI(A).
171*
172 DO 50 i = 1, n
173 work( i ) = zero
174 50 CONTINUE
175 DO 70 j = 1, n
176 DO 60 i = 1, min( n, j+1 )
177 work( i ) = work( i ) + abs( a( i, j ) )
178 60 CONTINUE
179 70 CONTINUE
180 VALUE = zero
181 DO 80 i = 1, n
182 sum = work( i )
183 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
184 80 CONTINUE
185 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
186 $ ( lsame( norm, 'E' ) ) ) THEN
187*
188* Find normF(A).
189*
190 scale = zero
191 sum = one
192 DO 90 j = 1, n
193 CALL zlassq( min( n, j+1 ), a( 1, j ), 1, scale, sum )
194 90 CONTINUE
195 VALUE = scale*sqrt( sum )
196 END IF
197*
198 zlanhs = VALUE
199 RETURN
200*
201* End of ZLANHS
202*
203 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlanhs(norm, n, a, lda, work)
ZLANHS returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition zlanhs.f:107
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