LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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:
 DPOEQU 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.
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
November 2011

Definition at line 114 of file dpoequb.f.

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