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