3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CPBEQU + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cpbequ.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cpbequ.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cpbequ.f">
21 * SUBROUTINE CPBEQU( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, KD, LDAB, N
28 * .. Array Arguments ..
30 * COMPLEX AB( LDAB, * )
39 *> CPBEQU computes row and column scalings intended to equilibrate a
40 *> Hermitian positive definite band matrix A and reduce its condition
41 *> number (with respect to the two-norm). S contains the scale factors,
42 *> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
43 *> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
44 *> choice of S puts the condition number of B within a factor N of the
45 *> smallest possible condition number over all possible diagonal
54 *> UPLO is CHARACTER*1
55 *> = 'U': Upper triangular of A is stored;
56 *> = 'L': Lower triangular of A is stored.
62 *> The order of the matrix A. N >= 0.
68 *> The number of superdiagonals of the matrix A if UPLO = 'U',
69 *> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
74 *> AB is COMPLEX array, dimension (LDAB,N)
75 *> The upper or lower triangle of the Hermitian band matrix A,
76 *> stored in the first KD+1 rows of the array. The j-th column
77 *> of A is stored in the j-th column of the array AB as follows:
78 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
79 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
85 *> The leading dimension of the array A. LDAB >= KD+1.
90 *> S is REAL array, dimension (N)
91 *> If INFO = 0, S contains the scale factors for A.
97 *> If INFO = 0, S contains the ratio of the smallest S(i) to
98 *> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
99 *> large nor too small, it is not worth scaling by S.
105 *> Absolute value of largest matrix element. If AMAX is very
106 *> close to overflow or very close to underflow, the matrix
113 *> = 0: successful exit
114 *> < 0: if INFO = -i, the i-th argument had an illegal value.
115 *> > 0: if INFO = i, the i-th diagonal element is nonpositive.
121 *> \author Univ. of Tennessee
122 *> \author Univ. of California Berkeley
123 *> \author Univ. of Colorado Denver
126 *> \date November 2011
128 *> \ingroup complexOTHERcomputational
130 * =====================================================================
131 SUBROUTINE CPBEQU( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, INFO )
133 * -- LAPACK computational routine (version 3.4.0) --
134 * -- LAPACK is a software package provided by Univ. of Tennessee, --
135 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
138 * .. Scalar Arguments ..
140 INTEGER INFO, KD, LDAB, N
143 * .. Array Arguments ..
145 COMPLEX AB( LDAB, * )
148 * =====================================================================
152 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
154 * .. Local Scalars ..
159 * .. External Functions ..
163 * .. External Subroutines ..
166 * .. Intrinsic Functions ..
167 INTRINSIC MAX, MIN, REAL, SQRT
169 * .. Executable Statements ..
171 * Test the input parameters.
174 UPPER = LSAME( UPLO, 'U' )
175 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
177 ELSE IF( N.LT.0 ) THEN
179 ELSE IF( KD.LT.0 ) THEN
181 ELSE IF( LDAB.LT.KD+1 ) THEN
185 CALL XERBLA( 'CPBEQU', -INFO )
189 * Quick return if possible
203 * Initialize SMIN and AMAX.
205 S( 1 ) = REAL( AB( J, 1 ) )
209 * Find the minimum and maximum diagonal elements.
212 S( I ) = REAL( AB( J, I ) )
213 SMIN = MIN( SMIN, S( I ) )
214 AMAX = MAX( AMAX, S( I ) )
217 IF( SMIN.LE.ZERO ) THEN
219 * Find the first non-positive diagonal element and return.
222 IF( S( I ).LE.ZERO ) THEN
229 * Set the scale factors to the reciprocals
230 * of the diagonal elements.
233 S( I ) = ONE / SQRT( S( I ) )
236 * Compute SCOND = min(S(I)) / max(S(I))
238 SCOND = SQRT( SMIN ) / SQRT( AMAX )