1 *> \brief \b SLAQGE scales a general rectangular matrix, using row and column scaling factors computed by sgeequ.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLAQGE + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaqge.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaqge.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaqge.f">
21 * SUBROUTINE SLAQGE( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
24 * .. Scalar Arguments ..
27 * REAL AMAX, COLCND, ROWCND
29 * .. Array Arguments ..
30 * REAL A( LDA, * ), C( * ), R( * )
39 *> SLAQGE equilibrates a general M by N matrix A using the row and
40 *> column scaling factors in the vectors R and C.
49 *> The number of rows of the matrix A. M >= 0.
55 *> The number of columns of the matrix A. N >= 0.
60 *> A is REAL array, dimension (LDA,N)
61 *> On entry, the M by N matrix A.
62 *> On exit, the equilibrated matrix. See EQUED for the form of
63 *> the equilibrated matrix.
69 *> The leading dimension of the array A. LDA >= max(M,1).
74 *> R is REAL array, dimension (M)
75 *> The row scale factors for A.
80 *> C is REAL array, dimension (N)
81 *> The column scale factors for A.
87 *> Ratio of the smallest R(i) to the largest R(i).
93 *> Ratio of the smallest C(i) to the largest C(i).
99 *> Absolute value of largest matrix entry.
104 *> EQUED is CHARACTER*1
105 *> Specifies the form of equilibration that was done.
106 *> = 'N': No equilibration
107 *> = 'R': Row equilibration, i.e., A has been premultiplied by
109 *> = 'C': Column equilibration, i.e., A has been postmultiplied
111 *> = 'B': Both row and column equilibration, i.e., A has been
112 *> replaced by diag(R) * A * diag(C).
115 *> \par Internal Parameters:
116 * =========================
119 *> THRESH is a threshold value used to decide if row or column scaling
120 *> should be done based on the ratio of the row or column scaling
121 *> factors. If ROWCND < THRESH, row scaling is done, and if
122 *> COLCND < THRESH, column scaling is done.
124 *> LARGE and SMALL are threshold values used to decide if row scaling
125 *> should be done based on the absolute size of the largest matrix
126 *> element. If AMAX > LARGE or AMAX < SMALL, row scaling is done.
132 *> \author Univ. of Tennessee
133 *> \author Univ. of California Berkeley
134 *> \author Univ. of Colorado Denver
137 *> \date September 2012
139 *> \ingroup realGEauxiliary
141 * =====================================================================
142 SUBROUTINE SLAQGE( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
145 * -- LAPACK auxiliary routine (version 3.4.2) --
146 * -- LAPACK is a software package provided by Univ. of Tennessee, --
147 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150 * .. Scalar Arguments ..
153 REAL AMAX, COLCND, ROWCND
155 * .. Array Arguments ..
156 REAL A( LDA, * ), C( * ), R( * )
159 * =====================================================================
163 PARAMETER ( ONE = 1.0E+0, THRESH = 0.1E+0 )
165 * .. Local Scalars ..
167 REAL CJ, LARGE, SMALL
169 * .. External Functions ..
173 * .. Executable Statements ..
175 * Quick return if possible
177 IF( M.LE.0 .OR. N.LE.0 ) THEN
182 * Initialize LARGE and SMALL.
184 SMALL = SLAMCH( 'Safe minimum' ) / SLAMCH( 'Precision' )
187 IF( ROWCND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE )
192 IF( COLCND.GE.THRESH ) THEN
204 A( I, J ) = CJ*A( I, J )
209 ELSE IF( COLCND.GE.THRESH ) THEN
211 * Row scaling, no column scaling
215 A( I, J ) = R( I )*A( I, J )
221 * Row and column scaling
226 A( I, J ) = CJ*R( I )*A( I, J )