LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
slaqge.f
Go to the documentation of this file.
1*> \brief \b SLAQGE scales a general rectangular matrix, using row and column scaling factors computed by sgeequ.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SLAQGE + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaqge.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaqge.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaqge.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SLAQGE( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
20* EQUED )
21*
22* .. Scalar Arguments ..
23* CHARACTER EQUED
24* INTEGER LDA, M, N
25* REAL AMAX, COLCND, ROWCND
26* ..
27* .. Array Arguments ..
28* REAL A( LDA, * ), C( * ), R( * )
29* ..
30*
31*
32*> \par Purpose:
33* =============
34*>
35*> \verbatim
36*>
37*> SLAQGE equilibrates a general M by N matrix A using the row and
38*> column scaling factors in the vectors R and C.
39*> \endverbatim
40*
41* Arguments:
42* ==========
43*
44*> \param[in] M
45*> \verbatim
46*> M is INTEGER
47*> The number of rows of the matrix A. M >= 0.
48*> \endverbatim
49*>
50*> \param[in] N
51*> \verbatim
52*> N is INTEGER
53*> The number of columns of the matrix A. N >= 0.
54*> \endverbatim
55*>
56*> \param[in,out] A
57*> \verbatim
58*> A is REAL array, dimension (LDA,N)
59*> On entry, the M by N matrix A.
60*> On exit, the equilibrated matrix. See EQUED for the form of
61*> the equilibrated matrix.
62*> \endverbatim
63*>
64*> \param[in] LDA
65*> \verbatim
66*> LDA is INTEGER
67*> The leading dimension of the array A. LDA >= max(M,1).
68*> \endverbatim
69*>
70*> \param[in] R
71*> \verbatim
72*> R is REAL array, dimension (M)
73*> The row scale factors for A.
74*> \endverbatim
75*>
76*> \param[in] C
77*> \verbatim
78*> C is REAL array, dimension (N)
79*> The column scale factors for A.
80*> \endverbatim
81*>
82*> \param[in] ROWCND
83*> \verbatim
84*> ROWCND is REAL
85*> Ratio of the smallest R(i) to the largest R(i).
86*> \endverbatim
87*>
88*> \param[in] COLCND
89*> \verbatim
90*> COLCND is REAL
91*> Ratio of the smallest C(i) to the largest C(i).
92*> \endverbatim
93*>
94*> \param[in] AMAX
95*> \verbatim
96*> AMAX is REAL
97*> Absolute value of largest matrix entry.
98*> \endverbatim
99*>
100*> \param[out] EQUED
101*> \verbatim
102*> EQUED is CHARACTER*1
103*> Specifies the form of equilibration that was done.
104*> = 'N': No equilibration
105*> = 'R': Row equilibration, i.e., A has been premultiplied by
106*> diag(R).
107*> = 'C': Column equilibration, i.e., A has been postmultiplied
108*> by diag(C).
109*> = 'B': Both row and column equilibration, i.e., A has been
110*> replaced by diag(R) * A * diag(C).
111*> \endverbatim
112*
113*> \par Internal Parameters:
114* =========================
115*>
116*> \verbatim
117*> THRESH is a threshold value used to decide if row or column scaling
118*> should be done based on the ratio of the row or column scaling
119*> factors. If ROWCND < THRESH, row scaling is done, and if
120*> COLCND < THRESH, column scaling is done.
121*>
122*> LARGE and SMALL are threshold values used to decide if row scaling
123*> should be done based on the absolute size of the largest matrix
124*> element. If AMAX > LARGE or AMAX < SMALL, row scaling is done.
125*> \endverbatim
126*
127* Authors:
128* ========
129*
130*> \author Univ. of Tennessee
131*> \author Univ. of California Berkeley
132*> \author Univ. of Colorado Denver
133*> \author NAG Ltd.
134*
135*> \ingroup laqge
136*
137* =====================================================================
138 SUBROUTINE slaqge( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
139 $ EQUED )
140*
141* -- LAPACK auxiliary routine --
142* -- LAPACK is a software package provided by Univ. of Tennessee, --
143* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
144*
145* .. Scalar Arguments ..
146 CHARACTER EQUED
147 INTEGER LDA, M, N
148 REAL AMAX, COLCND, ROWCND
149* ..
150* .. Array Arguments ..
151 REAL A( LDA, * ), C( * ), R( * )
152* ..
153*
154* =====================================================================
155*
156* .. Parameters ..
157 REAL ONE, THRESH
158 parameter( one = 1.0e+0, thresh = 0.1e+0 )
159* ..
160* .. Local Scalars ..
161 INTEGER I, J
162 REAL CJ, LARGE, SMALL
163* ..
164* .. External Functions ..
165 REAL SLAMCH
166 EXTERNAL slamch
167* ..
168* .. Executable Statements ..
169*
170* Quick return if possible
171*
172 IF( m.LE.0 .OR. n.LE.0 ) THEN
173 equed = 'N'
174 RETURN
175 END IF
176*
177* Initialize LARGE and SMALL.
178*
179 small = slamch( 'Safe minimum' ) / slamch( 'Precision' )
180 large = one / small
181*
182 IF( rowcnd.GE.thresh .AND. amax.GE.small .AND. amax.LE.large )
183 $ THEN
184*
185* No row scaling
186*
187 IF( colcnd.GE.thresh ) THEN
188*
189* No column scaling
190*
191 equed = 'N'
192 ELSE
193*
194* Column scaling
195*
196 DO 20 j = 1, n
197 cj = c( j )
198 DO 10 i = 1, m
199 a( i, j ) = cj*a( i, j )
200 10 CONTINUE
201 20 CONTINUE
202 equed = 'C'
203 END IF
204 ELSE IF( colcnd.GE.thresh ) THEN
205*
206* Row scaling, no column scaling
207*
208 DO 40 j = 1, n
209 DO 30 i = 1, m
210 a( i, j ) = r( i )*a( i, j )
211 30 CONTINUE
212 40 CONTINUE
213 equed = 'R'
214 ELSE
215*
216* Row and column scaling
217*
218 DO 60 j = 1, n
219 cj = c( j )
220 DO 50 i = 1, m
221 a( i, j ) = cj*r( i )*a( i, j )
222 50 CONTINUE
223 60 CONTINUE
224 equed = 'B'
225 END IF
226*
227 RETURN
228*
229* End of SLAQGE
230*
231 END
subroutine slaqge(m, n, a, lda, r, c, rowcnd, colcnd, amax, equed)
SLAQGE scales a general rectangular matrix, using row and column scaling factors computed by sgeequ.
Definition slaqge.f:140