LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ cpbequ()

subroutine cpbequ ( character  UPLO,
integer  N,
integer  KD,
complex, dimension( ldab, * )  AB,
integer  LDAB,
real, dimension( * )  S,
real  SCOND,
real  AMAX,
integer  INFO 
)

CPBEQU

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

Purpose:
 CPBEQU computes row and column scalings intended to equilibrate a
 Hermitian positive definite band 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]UPLO
          UPLO is CHARACTER*1
          = 'U':  Upper triangular of A is stored;
          = 'L':  Lower triangular of A is stored.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in]KD
          KD is INTEGER
          The number of superdiagonals of the matrix A if UPLO = 'U',
          or the number of subdiagonals if UPLO = 'L'.  KD >= 0.
[in]AB
          AB is COMPLEX array, dimension (LDAB,N)
          The upper or lower triangle of the Hermitian band matrix A,
          stored in the first KD+1 rows of the array.  The j-th column
          of A is stored in the j-th column of the array AB as follows:
          if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(n,j+kd).
[in]LDAB
          LDAB is INTEGER
          The leading dimension of the array A.  LDAB >= KD+1.
[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 129 of file cpbequ.f.

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