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