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