LAPACK  3.9.1
LAPACK: Linear Algebra PACKage

◆ zpoequb()

subroutine zpoequb ( integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
double precision, dimension( * )  S,
double precision  SCOND,
double precision  AMAX,
integer  INFO 
)

ZPOEQUB

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

Purpose:
 ZPOEQUB 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.

 This routine differs from ZPOEQU 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 COMPLEX*16 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 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.

Definition at line 118 of file zpoequb.f.

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