LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ dpoequb()

subroutine dpoequb ( integer n,
double precision, dimension( lda, * ) a,
integer lda,
double precision, dimension( * ) s,
double precision scond,
double precision amax,
integer info )

DPOEQUB

Download DPOEQUB + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!> !> DPOEQUB computes row and column scalings intended to equilibrate a !> symmetric positive definite matrix A and reduce its condition number !> (with respect to the two-norm). S contains the scale factors, !> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with !> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This !> choice of S puts the condition number of B within a factor N of the !> smallest possible condition number over all possible diagonal !> scalings. !> !> This routine differs from DPOEQU by restricting the scaling factors !> to a power of the radix. Barring over- and underflow, scaling by !> these factors introduces no additional rounding errors. However, the !> scaled diagonal entries are no longer approximately 1 but lie !> between sqrt(radix) and 1/sqrt(radix). !>
Parameters
[in]N
!> N is INTEGER !> The order of the matrix A. N >= 0. !>
[in]A
!> A is DOUBLE PRECISION array, dimension (LDA,N) !> The N-by-N symmetric positive definite matrix whose scaling !> factors are to be computed. Only the diagonal elements of A !> are referenced. !>
[in]LDA
!> LDA is INTEGER !> The leading dimension of the array A. LDA >= max(1,N). !>
[out]S
!> S is DOUBLE PRECISION array, dimension (N) !> If INFO = 0, S contains the scale factors for A. !>
[out]SCOND
!> SCOND is DOUBLE PRECISION !> If INFO = 0, S contains the ratio of the smallest S(i) to !> the largest S(i). If SCOND >= 0.1 and AMAX is neither too !> large nor too small, it is not worth scaling by S. !>
[out]AMAX
!> AMAX is DOUBLE PRECISION !> Absolute value of largest matrix element. If AMAX is very !> close to overflow or very close to underflow, the matrix !> should be scaled. !>
[out]INFO
!> INFO is INTEGER !> = 0: successful exit !> < 0: if INFO = -i, the i-th argument had an illegal value !> > 0: if INFO = i, the i-th diagonal element is nonpositive. !>
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 115 of file dpoequb.f.

116*
117* -- LAPACK computational routine --
118* -- LAPACK is a software package provided by Univ. of Tennessee, --
119* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
120*
121* .. Scalar Arguments ..
122 INTEGER INFO, LDA, N
123 DOUBLE PRECISION AMAX, SCOND
124* ..
125* .. Array Arguments ..
126 DOUBLE PRECISION A( LDA, * ), S( * )
127* ..
128*
129* =====================================================================
130*
131* .. Parameters ..
132 DOUBLE PRECISION ZERO, ONE
133 parameter( zero = 0.0d+0, one = 1.0d+0 )
134* ..
135* .. Local Scalars ..
136 INTEGER I
137 DOUBLE PRECISION SMIN, BASE, TMP
138* ..
139* .. External Functions ..
140 DOUBLE PRECISION DLAMCH
141 EXTERNAL dlamch
142* ..
143* .. External Subroutines ..
144 EXTERNAL xerbla
145* ..
146* .. Intrinsic Functions ..
147 INTRINSIC max, min, sqrt, log, int
148* ..
149* .. Executable Statements ..
150*
151* Test the input parameters.
152*
153* Positive definite only performs 1 pass of equilibration.
154*
155 info = 0
156 IF( n.LT.0 ) THEN
157 info = -1
158 ELSE IF( lda.LT.max( 1, n ) ) THEN
159 info = -3
160 END IF
161 IF( info.NE.0 ) THEN
162 CALL xerbla( 'DPOEQUB', -info )
163 RETURN
164 END IF
165*
166* Quick return if possible.
167*
168 IF( n.EQ.0 ) THEN
169 scond = one
170 amax = zero
171 RETURN
172 END IF
173
174 base = dlamch( 'B' )
175 tmp = -0.5d+0 / log( base )
176*
177* Find the minimum and maximum diagonal elements.
178*
179 s( 1 ) = a( 1, 1 )
180 smin = s( 1 )
181 amax = s( 1 )
182 DO 10 i = 2, n
183 s( i ) = a( i, i )
184 smin = min( smin, s( i ) )
185 amax = max( amax, s( i ) )
186 10 CONTINUE
187*
188 IF( smin.LE.zero ) THEN
189*
190* Find the first non-positive diagonal element and return.
191*
192 DO 20 i = 1, n
193 IF( s( i ).LE.zero ) THEN
194 info = i
195 RETURN
196 END IF
197 20 CONTINUE
198 ELSE
199*
200* Set the scale factors to the reciprocals
201* of the diagonal elements.
202*
203 DO 30 i = 1, n
204 s( i ) = base ** int( tmp * log( s( i ) ) )
205 30 CONTINUE
206*
207* Compute SCOND = min(S(I)) / max(S(I)).
208*
209 scond = sqrt( smin ) / sqrt( amax )
210 END IF
211*
212 RETURN
213*
214* End of DPOEQUB
215*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
Here is the call graph for this function:
Here is the caller graph for this function: