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