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

CPOEQU

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

Purpose:
 CPOEQU computes row and column scalings intended to equilibrate a
 Hermitian 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 Hermitian 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 cpoequ.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  REAL s( * )
127  COMPLEX a( lda, * )
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
139 * ..
140 * .. External Subroutines ..
141  EXTERNAL xerbla
142 * ..
143 * .. Intrinsic Functions ..
144  INTRINSIC max, min, REAL, sqrt
145 * ..
146 * .. Executable Statements ..
147 *
148 * Test the input parameters.
149 *
150  info = 0
151  IF( n.LT.0 ) THEN
152  info = -1
153  ELSE IF( lda.LT.max( 1, n ) ) THEN
154  info = -3
155  END IF
156  IF( info.NE.0 ) THEN
157  CALL xerbla( 'CPOEQU', -info )
158  RETURN
159  END IF
160 *
161 * Quick return if possible
162 *
163  IF( n.EQ.0 ) THEN
164  scond = one
165  amax = zero
166  RETURN
167  END IF
168 *
169 * Find the minimum and maximum diagonal elements.
170 *
171  s( 1 ) = REAL( A( 1, 1 ) )
172  smin = s( 1 )
173  amax = s( 1 )
174  DO 10 i = 2, n
175  s( i ) = REAL( A( I, I ) )
176  smin = min( smin, s( i ) )
177  amax = max( amax, s( i ) )
178  10 CONTINUE
179 *
180  IF( smin.LE.zero ) THEN
181 *
182 * Find the first non-positive diagonal element and return.
183 *
184  DO 20 i = 1, n
185  IF( s( i ).LE.zero ) THEN
186  info = i
187  RETURN
188  END IF
189  20 CONTINUE
190  ELSE
191 *
192 * Set the scale factors to the reciprocals
193 * of the diagonal elements.
194 *
195  DO 30 i = 1, n
196  s( i ) = one / sqrt( s( i ) )
197  30 CONTINUE
198 *
199 * Compute SCOND = min(S(I)) / max(S(I))
200 *
201  scond = sqrt( smin ) / sqrt( amax )
202  END IF
203  RETURN
204 *
205 * End of CPOEQU
206 *
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: