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