LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine dppequ ( character UPLO, integer N, double precision, dimension( * ) AP, double precision, dimension( * ) S, double precision SCOND, double precision AMAX, integer INFO )

DPPEQU

Purpose:
``` DPPEQU computes row and column scalings intended to equilibrate a
symmetric positive definite matrix A in packed storage 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.```
Parameters
 [in] UPLO ``` UPLO is CHARACTER*1 = 'U': Upper triangle of A is stored; = 'L': Lower triangle of A is stored.``` [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in] AP ``` AP is DOUBLE PRECISION array, dimension (N*(N+1)/2) The upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A is stored in the array AP as follows: if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=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.```
Date
November 2011

Definition at line 118 of file dppequ.f.

118 *
119 * -- LAPACK computational routine (version 3.4.0) --
120 * -- LAPACK is a software package provided by Univ. of Tennessee, --
121 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
122 * November 2011
123 *
124 * .. Scalar Arguments ..
125  CHARACTER uplo
126  INTEGER info, n
127  DOUBLE PRECISION amax, scond
128 * ..
129 * .. Array Arguments ..
130  DOUBLE PRECISION ap( * ), s( * )
131 * ..
132 *
133 * =====================================================================
134 *
135 * .. Parameters ..
136  DOUBLE PRECISION one, zero
137  parameter ( one = 1.0d+0, zero = 0.0d+0 )
138 * ..
139 * .. Local Scalars ..
140  LOGICAL upper
141  INTEGER i, jj
142  DOUBLE PRECISION smin
143 * ..
144 * .. External Functions ..
145  LOGICAL lsame
146  EXTERNAL lsame
147 * ..
148 * .. External Subroutines ..
149  EXTERNAL xerbla
150 * ..
151 * .. Intrinsic Functions ..
152  INTRINSIC max, min, sqrt
153 * ..
154 * .. Executable Statements ..
155 *
156 * Test the input parameters.
157 *
158  info = 0
159  upper = lsame( uplo, 'U' )
160  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
161  info = -1
162  ELSE IF( n.LT.0 ) THEN
163  info = -2
164  END IF
165  IF( info.NE.0 ) THEN
166  CALL xerbla( 'DPPEQU', -info )
167  RETURN
168  END IF
169 *
170 * Quick return if possible
171 *
172  IF( n.EQ.0 ) THEN
173  scond = one
174  amax = zero
175  RETURN
176  END IF
177 *
178 * Initialize SMIN and AMAX.
179 *
180  s( 1 ) = ap( 1 )
181  smin = s( 1 )
182  amax = s( 1 )
183 *
184  IF( upper ) THEN
185 *
186 * UPLO = 'U': Upper triangle of A is stored.
187 * Find the minimum and maximum diagonal elements.
188 *
189  jj = 1
190  DO 10 i = 2, n
191  jj = jj + i
192  s( i ) = ap( jj )
193  smin = min( smin, s( i ) )
194  amax = max( amax, s( i ) )
195  10 CONTINUE
196 *
197  ELSE
198 *
199 * UPLO = 'L': Lower triangle of A is stored.
200 * Find the minimum and maximum diagonal elements.
201 *
202  jj = 1
203  DO 20 i = 2, n
204  jj = jj + n - i + 2
205  s( i ) = ap( jj )
206  smin = min( smin, s( i ) )
207  amax = max( amax, s( i ) )
208  20 CONTINUE
209  END IF
210 *
211  IF( smin.LE.zero ) THEN
212 *
213 * Find the first non-positive diagonal element and return.
214 *
215  DO 30 i = 1, n
216  IF( s( i ).LE.zero ) THEN
217  info = i
218  RETURN
219  END IF
220  30 CONTINUE
221  ELSE
222 *
223 * Set the scale factors to the reciprocals
224 * of the diagonal elements.
225 *
226  DO 40 i = 1, n
227  s( i ) = one / sqrt( s( i ) )
228  40 CONTINUE
229 *
230 * Compute SCOND = min(S(I)) / max(S(I))
231 *
232  scond = sqrt( smin ) / sqrt( amax )
233  END IF
234  RETURN
235 *
236 * End of DPPEQU
237 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: