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
zlaqge.f
Go to the documentation of this file.
1  SUBROUTINE zlaqge( M, N, A, LDA, R, C, ROWCND, COLCND, AMAX,
2  $ equed )
3 *
4 * -- LAPACK auxiliary routine (version 3.2) --
5 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
6 * November 2006
7 *
8 * .. Scalar Arguments ..
9  CHARACTER equed
10  INTEGER lda, m, n
11  DOUBLE PRECISION amax, colcnd, rowcnd
12 * ..
13 * .. Array Arguments ..
14  DOUBLE PRECISION c( * ), r( * )
15  COMPLEX*16 a( lda, * )
16 * ..
17 *
18 * Purpose
19 * =======
20 *
21 * ZLAQGE equilibrates a general M by N matrix A using the row and
22 * column scaling factors in the vectors R and C.
23 *
24 * Arguments
25 * =========
26 *
27 * M (input) INTEGER
28 * The number of rows of the matrix A. M >= 0.
29 *
30 * N (input) INTEGER
31 * The number of columns of the matrix A. N >= 0.
32 *
33 * A (input/output) COMPLEX*16 array, dimension (LDA,N)
34 * On entry, the M by N matrix A.
35 * On exit, the equilibrated matrix. See EQUED for the form of
36 * the equilibrated matrix.
37 *
38 * LDA (input) INTEGER
39 * The leading dimension of the array A. LDA >= max(M,1).
40 *
41 * R (input) DOUBLE PRECISION array, dimension (M)
42 * The row scale factors for A.
43 *
44 * C (input) DOUBLE PRECISION array, dimension (N)
45 * The column scale factors for A.
46 *
47 * ROWCND (input) DOUBLE PRECISION
48 * Ratio of the smallest R(i) to the largest R(i).
49 *
50 * COLCND (input) DOUBLE PRECISION
51 * Ratio of the smallest C(i) to the largest C(i).
52 *
53 * AMAX (input) DOUBLE PRECISION
54 * Absolute value of largest matrix entry.
55 *
56 * EQUED (output) CHARACTER*1
57 * Specifies the form of equilibration that was done.
58 * = 'N': No equilibration
59 * = 'R': Row equilibration, i.e., A has been premultiplied by
60 * diag(R).
61 * = 'C': Column equilibration, i.e., A has been postmultiplied
62 * by diag(C).
63 * = 'B': Both row and column equilibration, i.e., A has been
64 * replaced by diag(R) * A * diag(C).
65 *
66 * Internal Parameters
67 * ===================
68 *
69 * THRESH is a threshold value used to decide if row or column scaling
70 * should be done based on the ratio of the row or column scaling
71 * factors. If ROWCND < THRESH, row scaling is done, and if
72 * COLCND < THRESH, column scaling is done.
73 *
74 * LARGE and SMALL are threshold values used to decide if row scaling
75 * should be done based on the absolute size of the largest matrix
76 * element. If AMAX > LARGE or AMAX < SMALL, row scaling is done.
77 *
78 * =====================================================================
79 *
80 * .. Parameters ..
81  DOUBLE PRECISION one, thresh
82  parameter( one = 1.0d+0, thresh = 0.1d+0 )
83 * ..
84 * .. Local Scalars ..
85  INTEGER i, j
86  DOUBLE PRECISION cj, large, small
87 * ..
88 * .. External Functions ..
89  DOUBLE PRECISION dlamch
90  EXTERNAL dlamch
91 * ..
92 * .. Executable Statements ..
93 *
94 * Quick return if possible
95 *
96  IF( m.LE.0 .OR. n.LE.0 ) THEN
97  equed = 'N'
98  return
99  END IF
100 *
101 * Initialize LARGE and SMALL.
102 *
103  small = dlamch( 'Safe minimum' ) / dlamch( 'Precision' )
104  large = one / small
105 *
106  IF( rowcnd.GE.thresh .AND. amax.GE.small .AND. amax.LE.large )
107  $ THEN
108 *
109 * No row scaling
110 *
111  IF( colcnd.GE.thresh ) THEN
112 *
113 * No column scaling
114 *
115  equed = 'N'
116  ELSE
117 *
118 * Column scaling
119 *
120  DO 20 j = 1, n
121  cj = c( j )
122  DO 10 i = 1, m
123  a( i, j ) = cj*a( i, j )
124  10 continue
125  20 continue
126  equed = 'C'
127  END IF
128  ELSE IF( colcnd.GE.thresh ) THEN
129 *
130 * Row scaling, no column scaling
131 *
132  DO 40 j = 1, n
133  DO 30 i = 1, m
134  a( i, j ) = r( i )*a( i, j )
135  30 continue
136  40 continue
137  equed = 'R'
138  ELSE
139 *
140 * Row and column scaling
141 *
142  DO 60 j = 1, n
143  cj = c( j )
144  DO 50 i = 1, m
145  a( i, j ) = cj*r( i )*a( i, j )
146  50 continue
147  60 continue
148  equed = 'B'
149  END IF
150 *
151  return
152 *
153 * End of ZLAQGE
154 *
155  END