LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zppequ.f
Go to the documentation of this file.
1*> \brief \b ZPPEQU
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZPPEQU + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zppequ.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zppequ.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zppequ.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZPPEQU( UPLO, N, AP, S, SCOND, AMAX, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER UPLO
23* INTEGER INFO, N
24* DOUBLE PRECISION AMAX, SCOND
25* ..
26* .. Array Arguments ..
27* DOUBLE PRECISION S( * )
28* COMPLEX*16 AP( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> ZPPEQU computes row and column scalings intended to equilibrate a
38*> Hermitian positive definite matrix A in packed storage and reduce
39*> its condition number (with respect to the two-norm). S contains the
40*> scale factors, S(i)=1/sqrt(A(i,i)), chosen so that the scaled matrix
41*> B with elements B(i,j)=S(i)*A(i,j)*S(j) has ones on the diagonal.
42*> This choice of S puts the condition number of B within a factor N of
43*> the smallest possible condition number over all possible diagonal
44*> scalings.
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] UPLO
51*> \verbatim
52*> UPLO is CHARACTER*1
53*> = 'U': Upper triangle of A is stored;
54*> = 'L': Lower triangle of A is stored.
55*> \endverbatim
56*>
57*> \param[in] N
58*> \verbatim
59*> N is INTEGER
60*> The order of the matrix A. N >= 0.
61*> \endverbatim
62*>
63*> \param[in] AP
64*> \verbatim
65*> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
66*> The upper or lower triangle of the Hermitian matrix A, packed
67*> columnwise in a linear array. The j-th column of A is stored
68*> in the array AP as follows:
69*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
70*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
71*> \endverbatim
72*>
73*> \param[out] S
74*> \verbatim
75*> S is DOUBLE PRECISION array, dimension (N)
76*> If INFO = 0, S contains the scale factors for A.
77*> \endverbatim
78*>
79*> \param[out] SCOND
80*> \verbatim
81*> SCOND is DOUBLE PRECISION
82*> If INFO = 0, S contains the ratio of the smallest S(i) to
83*> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
84*> large nor too small, it is not worth scaling by S.
85*> \endverbatim
86*>
87*> \param[out] AMAX
88*> \verbatim
89*> AMAX is DOUBLE PRECISION
90*> Absolute value of largest matrix element. If AMAX is very
91*> close to overflow or very close to underflow, the matrix
92*> should be scaled.
93*> \endverbatim
94*>
95*> \param[out] INFO
96*> \verbatim
97*> INFO is INTEGER
98*> = 0: successful exit
99*> < 0: if INFO = -i, the i-th argument had an illegal value
100*> > 0: if INFO = i, the i-th diagonal element is nonpositive.
101*> \endverbatim
102*
103* Authors:
104* ========
105*
106*> \author Univ. of Tennessee
107*> \author Univ. of California Berkeley
108*> \author Univ. of Colorado Denver
109*> \author NAG Ltd.
110*
111*> \ingroup ppequ
112*
113* =====================================================================
114 SUBROUTINE zppequ( UPLO, N, AP, S, SCOND, AMAX, INFO )
115*
116* -- LAPACK computational 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 UPLO
122 INTEGER INFO, N
123 DOUBLE PRECISION AMAX, SCOND
124* ..
125* .. Array Arguments ..
126 DOUBLE PRECISION S( * )
127 COMPLEX*16 AP( * )
128* ..
129*
130* =====================================================================
131*
132* .. Parameters ..
133 DOUBLE PRECISION ONE, ZERO
134 parameter( one = 1.0d+0, zero = 0.0d+0 )
135* ..
136* .. Local Scalars ..
137 LOGICAL UPPER
138 INTEGER I, JJ
139 DOUBLE PRECISION SMIN
140* ..
141* .. External Functions ..
142 LOGICAL LSAME
143 EXTERNAL lsame
144* ..
145* .. External Subroutines ..
146 EXTERNAL xerbla
147* ..
148* .. Intrinsic Functions ..
149 INTRINSIC dble, max, min, sqrt
150* ..
151* .. Executable Statements ..
152*
153* Test the input parameters.
154*
155 info = 0
156 upper = lsame( uplo, 'U' )
157 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
158 info = -1
159 ELSE IF( n.LT.0 ) THEN
160 info = -2
161 END IF
162 IF( info.NE.0 ) THEN
163 CALL xerbla( 'ZPPEQU', -info )
164 RETURN
165 END IF
166*
167* Quick return if possible
168*
169 IF( n.EQ.0 ) THEN
170 scond = one
171 amax = zero
172 RETURN
173 END IF
174*
175* Initialize SMIN and AMAX.
176*
177 s( 1 ) = dble( ap( 1 ) )
178 smin = s( 1 )
179 amax = s( 1 )
180*
181 IF( upper ) THEN
182*
183* UPLO = 'U': Upper triangle of A is stored.
184* Find the minimum and maximum diagonal elements.
185*
186 jj = 1
187 DO 10 i = 2, n
188 jj = jj + i
189 s( i ) = dble( ap( jj ) )
190 smin = min( smin, s( i ) )
191 amax = max( amax, s( i ) )
192 10 CONTINUE
193*
194 ELSE
195*
196* UPLO = 'L': Lower triangle of A is stored.
197* Find the minimum and maximum diagonal elements.
198*
199 jj = 1
200 DO 20 i = 2, n
201 jj = jj + n - i + 2
202 s( i ) = dble( ap( jj ) )
203 smin = min( smin, s( i ) )
204 amax = max( amax, s( i ) )
205 20 CONTINUE
206 END IF
207*
208 IF( smin.LE.zero ) THEN
209*
210* Find the first non-positive diagonal element and return.
211*
212 DO 30 i = 1, n
213 IF( s( i ).LE.zero ) THEN
214 info = i
215 RETURN
216 END IF
217 30 CONTINUE
218 ELSE
219*
220* Set the scale factors to the reciprocals
221* of the diagonal elements.
222*
223 DO 40 i = 1, n
224 s( i ) = one / sqrt( s( i ) )
225 40 CONTINUE
226*
227* Compute SCOND = min(S(I)) / max(S(I))
228*
229 scond = sqrt( smin ) / sqrt( amax )
230 END IF
231 RETURN
232*
233* End of ZPPEQU
234*
235 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zppequ(uplo, n, ap, s, scond, amax, info)
ZPPEQU
Definition zppequ.f:115