LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cpoequb ( integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
real, dimension( * )  S,
real  SCOND,
real  AMAX,
integer  INFO 
)

CPOEQUB

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

Purpose:
 CPOEQUB 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 COMPLEX 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 REAL array, dimension (N)
          If INFO = 0, S contains the scale factors for A.
[out]SCOND
          SCOND is REAL
          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 REAL
          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 115 of file cpoequb.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: