LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 120 of file dpoequb.f.

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