3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SPBEQU + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spbequ.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spbequ.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spbequ.f">
21 * SUBROUTINE SPBEQU( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, INFO )
23 * .. Scalar Arguments ..
25 * INTEGER INFO, KD, LDAB, N
28 * .. Array Arguments ..
29 * REAL AB( LDAB, * ), S( * )
38 *> SPBEQU computes row and column scalings intended to equilibrate a
39 *> symmetric positive definite band matrix A and reduce its condition
40 *> number (with respect to the two-norm). S contains the scale factors,
41 *> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
42 *> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
43 *> choice of S puts the condition number of B within a factor N of the
44 *> smallest possible condition number over all possible diagonal
53 *> UPLO is CHARACTER*1
54 *> = 'U': Upper triangular of A is stored;
55 *> = 'L': Lower triangular of A is stored.
61 *> The order of the matrix A. N >= 0.
67 *> The number of superdiagonals of the matrix A if UPLO = 'U',
68 *> or the number of subdiagonals if UPLO = 'L'. KD >= 0.
73 *> AB is REAL array, dimension (LDAB,N)
74 *> The upper or lower triangle of the symmetric band matrix A,
75 *> stored in the first KD+1 rows of the array. The j-th column
76 *> of A is stored in the j-th column of the array AB as follows:
77 *> if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
78 *> if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
84 *> The leading dimension of the array A. LDAB >= KD+1.
89 *> S is REAL array, dimension (N)
90 *> If INFO = 0, S contains the scale factors for A.
96 *> If INFO = 0, S contains the ratio of the smallest S(i) to
97 *> the largest S(i). If SCOND >= 0.1 and AMAX is neither too
98 *> large nor too small, it is not worth scaling by S.
104 *> Absolute value of largest matrix element. If AMAX is very
105 *> close to overflow or very close to underflow, the matrix
112 *> = 0: successful exit
113 *> < 0: if INFO = -i, the i-th argument had an illegal value.
114 *> > 0: if INFO = i, the i-th diagonal element is nonpositive.
120 *> \author Univ. of Tennessee
121 *> \author Univ. of California Berkeley
122 *> \author Univ. of Colorado Denver
125 *> \date November 2011
127 *> \ingroup realOTHERcomputational
129 * =====================================================================
130 SUBROUTINE SPBEQU( UPLO, N, KD, AB, LDAB, S, SCOND, AMAX, INFO )
132 * -- LAPACK computational routine (version 3.4.0) --
133 * -- LAPACK is a software package provided by Univ. of Tennessee, --
134 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
137 * .. Scalar Arguments ..
139 INTEGER INFO, KD, LDAB, N
142 * .. Array Arguments ..
143 REAL AB( LDAB, * ), S( * )
146 * =====================================================================
150 PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
152 * .. Local Scalars ..
157 * .. External Functions ..
161 * .. External Subroutines ..
164 * .. Intrinsic Functions ..
165 INTRINSIC MAX, MIN, SQRT
167 * .. Executable Statements ..
169 * Test the input parameters.
172 UPPER = LSAME( UPLO, 'U' )
173 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
175 ELSE IF( N.LT.0 ) THEN
177 ELSE IF( KD.LT.0 ) THEN
179 ELSE IF( LDAB.LT.KD+1 ) THEN
183 CALL XERBLA( 'SPBEQU', -INFO )
187 * Quick return if possible
201 * Initialize SMIN and AMAX.
207 * Find the minimum and maximum diagonal elements.
211 SMIN = MIN( SMIN, S( I ) )
212 AMAX = MAX( AMAX, S( I ) )
215 IF( SMIN.LE.ZERO ) THEN
217 * Find the first non-positive diagonal element and return.
220 IF( S( I ).LE.ZERO ) THEN
227 * Set the scale factors to the reciprocals
228 * of the diagonal elements.
231 S( I ) = ONE / SQRT( S( I ) )
234 * Compute SCOND = min(S(I)) / max(S(I))
236 SCOND = SQRT( SMIN ) / SQRT( AMAX )