LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cpoequ()

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.

Definition at line 112 of file cpoequ.f.

113*
114* -- LAPACK computational routine --
115* -- LAPACK is a software package provided by Univ. of Tennessee, --
116* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117*
118* .. Scalar Arguments ..
119 INTEGER INFO, LDA, N
120 REAL AMAX, SCOND
121* ..
122* .. Array Arguments ..
123 REAL S( * )
124 COMPLEX A( LDA, * )
125* ..
126*
127* =====================================================================
128*
129* .. Parameters ..
130 REAL ZERO, ONE
131 parameter( zero = 0.0e+0, one = 1.0e+0 )
132* ..
133* .. Local Scalars ..
134 INTEGER I
135 REAL SMIN
136* ..
137* .. External Subroutines ..
138 EXTERNAL xerbla
139* ..
140* .. Intrinsic Functions ..
141 INTRINSIC max, min, real, sqrt
142* ..
143* .. Executable Statements ..
144*
145* Test the input parameters.
146*
147 info = 0
148 IF( n.LT.0 ) THEN
149 info = -1
150 ELSE IF( lda.LT.max( 1, n ) ) THEN
151 info = -3
152 END IF
153 IF( info.NE.0 ) THEN
154 CALL xerbla( 'CPOEQU', -info )
155 RETURN
156 END IF
157*
158* Quick return if possible
159*
160 IF( n.EQ.0 ) THEN
161 scond = one
162 amax = zero
163 RETURN
164 END IF
165*
166* Find the minimum and maximum diagonal elements.
167*
168 s( 1 ) = real( a( 1, 1 ) )
169 smin = s( 1 )
170 amax = s( 1 )
171 DO 10 i = 2, n
172 s( i ) = real( a( i, i ) )
173 smin = min( smin, s( i ) )
174 amax = max( amax, s( i ) )
175 10 CONTINUE
176*
177 IF( smin.LE.zero ) THEN
178*
179* Find the first non-positive diagonal element and return.
180*
181 DO 20 i = 1, n
182 IF( s( i ).LE.zero ) THEN
183 info = i
184 RETURN
185 END IF
186 20 CONTINUE
187 ELSE
188*
189* Set the scale factors to the reciprocals
190* of the diagonal elements.
191*
192 DO 30 i = 1, n
193 s( i ) = one / sqrt( s( i ) )
194 30 CONTINUE
195*
196* Compute SCOND = min(S(I)) / max(S(I))
197*
198 scond = sqrt( smin ) / sqrt( amax )
199 END IF
200 RETURN
201*
202* End of CPOEQU
203*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
Here is the call graph for this function:
Here is the caller graph for this function: