PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
dlaqsy.f
Go to the documentation of this file.
1  SUBROUTINE dlaqsy( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED )
2 *
3 * -- LAPACK auxiliary routine (version 3.2) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8  CHARACTER equed, uplo
9  INTEGER lda, n
10  DOUBLE PRECISION amax, scond
11 * ..
12 * .. Array Arguments ..
13  DOUBLE PRECISION a( lda, * ), s( * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * DLAQSY equilibrates a symmetric matrix A using the scaling factors
20 * in the vector S.
21 *
22 * Arguments
23 * =========
24 *
25 * UPLO (input) CHARACTER*1
26 * Specifies whether the upper or lower triangular part of the
27 * symmetric matrix A is stored.
28 * = 'U': Upper triangular
29 * = 'L': Lower triangular
30 *
31 * N (input) INTEGER
32 * The order of the matrix A. N >= 0.
33 *
34 * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
35 * On entry, the symmetric matrix A. If UPLO = 'U', the leading
36 * n by n upper triangular part of A contains the upper
37 * triangular part of the matrix A, and the strictly lower
38 * triangular part of A is not referenced. If UPLO = 'L', the
39 * leading n by n lower triangular part of A contains the lower
40 * triangular part of the matrix A, and the strictly upper
41 * triangular part of A is not referenced.
42 *
43 * On exit, if EQUED = 'Y', the equilibrated matrix:
44 * diag(S) * A * diag(S).
45 *
46 * LDA (input) INTEGER
47 * The leading dimension of the array A. LDA >= max(N,1).
48 *
49 * S (input) DOUBLE PRECISION array, dimension (N)
50 * The scale factors for A.
51 *
52 * SCOND (input) DOUBLE PRECISION
53 * Ratio of the smallest S(i) to the largest S(i).
54 *
55 * AMAX (input) DOUBLE PRECISION
56 * Absolute value of largest matrix entry.
57 *
58 * EQUED (output) CHARACTER*1
59 * Specifies whether or not equilibration was done.
60 * = 'N': No equilibration.
61 * = 'Y': Equilibration was done, i.e., A has been replaced by
62 * diag(S) * A * diag(S).
63 *
64 * Internal Parameters
65 * ===================
66 *
67 * THRESH is a threshold value used to decide if scaling should be done
68 * based on the ratio of the scaling factors. If SCOND < THRESH,
69 * scaling is done.
70 *
71 * LARGE and SMALL are threshold values used to decide if scaling should
72 * be done based on the absolute size of the largest matrix element.
73 * If AMAX > LARGE or AMAX < SMALL, scaling is done.
74 *
75 * =====================================================================
76 *
77 * .. Parameters ..
78  DOUBLE PRECISION one, thresh
79  parameter( one = 1.0d+0, thresh = 0.1d+0 )
80 * ..
81 * .. Local Scalars ..
82  INTEGER i, j
83  DOUBLE PRECISION cj, large, small
84 * ..
85 * .. External Functions ..
86  LOGICAL lsame
87  DOUBLE PRECISION dlamch
88  EXTERNAL lsame, dlamch
89 * ..
90 * .. Executable Statements ..
91 *
92 * Quick return if possible
93 *
94  IF( n.LE.0 ) THEN
95  equed = 'N'
96  return
97  END IF
98 *
99 * Initialize LARGE and SMALL.
100 *
101  small = dlamch( 'Safe minimum' ) / dlamch( 'Precision' )
102  large = one / small
103 *
104  IF( scond.GE.thresh .AND. amax.GE.small .AND. amax.LE.large ) THEN
105 *
106 * No equilibration
107 *
108  equed = 'N'
109  ELSE
110 *
111 * Replace A by diag(S) * A * diag(S).
112 *
113  IF( lsame( uplo, 'U' ) ) THEN
114 *
115 * Upper triangle of A is stored.
116 *
117  DO 20 j = 1, n
118  cj = s( j )
119  DO 10 i = 1, j
120  a( i, j ) = cj*s( i )*a( i, j )
121  10 continue
122  20 continue
123  ELSE
124 *
125 * Lower triangle of A is stored.
126 *
127  DO 40 j = 1, n
128  cj = s( j )
129  DO 30 i = j, n
130  a( i, j ) = cj*s( i )*a( i, j )
131  30 continue
132  40 continue
133  END IF
134  equed = 'Y'
135  END IF
136 *
137  return
138 *
139 * End of DLAQSY
140 *
141  END