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

◆ zppequ()

subroutine zppequ ( character  uplo,
integer  n,
complex*16, dimension( * )  ap,
double precision, dimension( * )  s,
double precision  scond,
double precision  amax,
integer  info 
)

ZPPEQU

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

Purpose:
 ZPPEQU computes row and column scalings intended to equilibrate a
 Hermitian positive definite matrix A in packed storage 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]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangle of A is stored;
          = 'L':  Lower triangle of A is stored.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]AP
          AP is COMPLEX*16 array, dimension (N*(N+1)/2)
          The upper or lower triangle of the Hermitian matrix A, packed
          columnwise in a linear array.  The j-th column of A is stored
          in the array AP as follows:
          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=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 116 of file zppequ.f.

117*
118* -- LAPACK computational routine --
119* -- LAPACK is a software package provided by Univ. of Tennessee, --
120* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121*
122* .. Scalar Arguments ..
123 CHARACTER UPLO
124 INTEGER INFO, N
125 DOUBLE PRECISION AMAX, SCOND
126* ..
127* .. Array Arguments ..
128 DOUBLE PRECISION S( * )
129 COMPLEX*16 AP( * )
130* ..
131*
132* =====================================================================
133*
134* .. Parameters ..
135 DOUBLE PRECISION ONE, ZERO
136 parameter( one = 1.0d+0, zero = 0.0d+0 )
137* ..
138* .. Local Scalars ..
139 LOGICAL UPPER
140 INTEGER I, JJ
141 DOUBLE PRECISION SMIN
142* ..
143* .. External Functions ..
144 LOGICAL LSAME
145 EXTERNAL lsame
146* ..
147* .. External Subroutines ..
148 EXTERNAL xerbla
149* ..
150* .. Intrinsic Functions ..
151 INTRINSIC dble, max, min, sqrt
152* ..
153* .. Executable Statements ..
154*
155* Test the input parameters.
156*
157 info = 0
158 upper = lsame( uplo, 'U' )
159 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
160 info = -1
161 ELSE IF( n.LT.0 ) THEN
162 info = -2
163 END IF
164 IF( info.NE.0 ) THEN
165 CALL xerbla( 'ZPPEQU', -info )
166 RETURN
167 END IF
168*
169* Quick return if possible
170*
171 IF( n.EQ.0 ) THEN
172 scond = one
173 amax = zero
174 RETURN
175 END IF
176*
177* Initialize SMIN and AMAX.
178*
179 s( 1 ) = dble( ap( 1 ) )
180 smin = s( 1 )
181 amax = s( 1 )
182*
183 IF( upper ) THEN
184*
185* UPLO = 'U': Upper triangle of A is stored.
186* Find the minimum and maximum diagonal elements.
187*
188 jj = 1
189 DO 10 i = 2, n
190 jj = jj + i
191 s( i ) = dble( ap( jj ) )
192 smin = min( smin, s( i ) )
193 amax = max( amax, s( i ) )
194 10 CONTINUE
195*
196 ELSE
197*
198* UPLO = 'L': Lower triangle of A is stored.
199* Find the minimum and maximum diagonal elements.
200*
201 jj = 1
202 DO 20 i = 2, n
203 jj = jj + n - i + 2
204 s( i ) = dble( ap( jj ) )
205 smin = min( smin, s( i ) )
206 amax = max( amax, s( i ) )
207 20 CONTINUE
208 END IF
209*
210 IF( smin.LE.zero ) THEN
211*
212* Find the first non-positive diagonal element and return.
213*
214 DO 30 i = 1, n
215 IF( s( i ).LE.zero ) THEN
216 info = i
217 RETURN
218 END IF
219 30 CONTINUE
220 ELSE
221*
222* Set the scale factors to the reciprocals
223* of the diagonal elements.
224*
225 DO 40 i = 1, n
226 s( i ) = one / sqrt( s( i ) )
227 40 CONTINUE
228*
229* Compute SCOND = min(S(I)) / max(S(I))
230*
231 scond = sqrt( smin ) / sqrt( amax )
232 END IF
233 RETURN
234*
235* End of ZPPEQU
236*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: