ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
cmmtcadd.f
Go to the documentation of this file.
1  SUBROUTINE cmmtcadd( M, N, ALPHA, A, LDA, BETA, B, LDB )
2 *
3 * -- PBLAS auxiliary routine (version 2.0) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * April 1, 1998
7 *
8 * .. Scalar Arguments ..
9  INTEGER LDA, LDB, M, N
10  COMPLEX ALPHA, BETA
11 * ..
12 * .. Array Arguments ..
13  COMPLEX A( LDA, * ), B( LDB, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * CMMTCADD performs the following operation:
20 *
21 * B := alpha * conjg( A' ) + beta * B,
22 *
23 * where alpha, beta are scalars; A is an m by n matrix and B is an n by
24 * m matrix.
25 *
26 * Arguments
27 * =========
28 *
29 * M (local input) INTEGER
30 * On entry, M specifies the number of rows of A and the number
31 * of columns of B. M must be at least zero.
32 *
33 * N (local input) INTEGER
34 * On entry, N specifies the number of rows of B and the number
35 * of columns of A. N must be at least zero.
36 *
37 * ALPHA (local input) COMPLEX
38 * On entry, ALPHA specifies the scalar alpha. When ALPHA is
39 * supplied as zero then the local entries of the array A need
40 * not be set on input.
41 *
42 * A (local input) COMPLEX array
43 * On entry, A is an array of dimension ( LDA, N ).
44 *
45 * LDA (local input) INTEGER
46 * On entry, LDA specifies the leading dimension of the array A.
47 * LDA must be at least max( 1, M ).
48 *
49 * BETA (local input) COMPLEX
50 * On entry, BETA specifies the scalar beta. When BETA is sup-
51 * plied as zero then the local entries of the array B need not
52 * be set on input.
53 *
54 * B (local input/local output) COMPLEX array
55 * On entry, B is an array of dimension ( LDB, M ). On exit, the
56 * leading m by n part of A has been conjugated and added to the
57 * leading n by m part of B.
58 *
59 * LDB (local input) INTEGER
60 * On entry, LDB specifies the leading dimension of the array B.
61 * LDB must be at least max( 1, N ).
62 *
63 * -- Written on April 1, 1998 by
64 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
65 *
66 * =====================================================================
67 *
68 * .. Parameters ..
69  COMPLEX ONE, ZERO
70  parameter( one = ( 1.0e+0, 0.0e+0 ),
71  $ zero = ( 0.0e+0, 0.0e+0 ) )
72 * ..
73 * .. Local Scalars ..
74  INTEGER I, J
75 * ..
76 * .. External Subroutines ..
77  EXTERNAL cscal
78 * ..
79 * .. Intrinsic Functions ..
80  INTRINSIC conjg
81 * ..
82 * .. Executable Statements ..
83 *
84  IF( m.GE.n ) THEN
85  IF( alpha.EQ.one ) THEN
86  IF( beta.EQ.zero ) THEN
87  DO 20 j = 1, n
88  DO 10 i = 1, m
89  b( j, i ) = conjg( a( i, j ) )
90  10 CONTINUE
91  20 CONTINUE
92  ELSE IF( beta.NE.one ) THEN
93  DO 40 j = 1, n
94  DO 30 i = 1, m
95  b( j, i ) = conjg( a( i, j ) ) + beta * b( j, i )
96  30 CONTINUE
97  40 CONTINUE
98  ELSE
99  DO 60 j = 1, n
100  DO 50 i = 1, m
101  b( j, i ) = conjg( a( i, j ) ) + b( j, i )
102  50 CONTINUE
103  60 CONTINUE
104  END IF
105  ELSE IF( alpha.NE.zero ) THEN
106  IF( beta.EQ.zero ) THEN
107  DO 80 j = 1, n
108  DO 70 i = 1, m
109  b( j, i ) = alpha * conjg( a( i, j ) )
110  70 CONTINUE
111  80 CONTINUE
112  ELSE IF( beta.NE.one ) THEN
113  DO 100 j = 1, n
114  DO 90 i = 1, m
115  b( j, i ) = alpha * conjg( a( i, j ) ) +
116  $ beta * b( j, i )
117  90 CONTINUE
118  100 CONTINUE
119  ELSE
120  DO 120 j = 1, n
121  DO 110 i = 1, m
122  b( j, i ) = alpha * conjg( a( i, j ) ) + b( j, i )
123  110 CONTINUE
124  120 CONTINUE
125  END IF
126  ELSE
127  IF( beta.EQ.zero ) THEN
128  DO 140 j = 1, m
129  DO 130 i = 1, n
130  b( i, j ) = zero
131  130 CONTINUE
132  140 CONTINUE
133  ELSE IF( beta.NE.one ) THEN
134  DO 160 j = 1, m
135  CALL cscal( n, beta, b( 1, j ), 1 )
136 * DO 150 I = 1, N
137 * B( I, J ) = BETA * B( I, J )
138 * 150 CONTINUE
139  160 CONTINUE
140  END IF
141  END IF
142  ELSE
143  IF( alpha.EQ.one ) THEN
144  IF( beta.EQ.zero ) THEN
145  DO 180 j = 1, m
146  DO 170 i = 1, n
147  b( i, j ) = conjg( a( j, i ) )
148  170 CONTINUE
149  180 CONTINUE
150  ELSE IF( beta.NE.one ) THEN
151  DO 200 j = 1, m
152  DO 190 i = 1, n
153  b( i, j ) = conjg( a( j, i ) ) + beta * b( i, j )
154  190 CONTINUE
155  200 CONTINUE
156  ELSE
157  DO 220 j = 1, m
158  DO 210 i = 1, n
159  b( i, j ) = conjg( a( j, i ) ) + b( i, j )
160  210 CONTINUE
161  220 CONTINUE
162  END IF
163  ELSE IF( alpha.NE.zero ) THEN
164  IF( beta.EQ.zero ) THEN
165  DO 240 j = 1, m
166  DO 230 i = 1, n
167  b( i, j ) = alpha * conjg( a( j, i ) )
168  230 CONTINUE
169  240 CONTINUE
170  ELSE IF( beta.NE.one ) THEN
171  DO 260 j = 1, m
172  DO 250 i = 1, n
173  b( i, j ) = alpha * conjg( a( j, i ) ) +
174  $ beta * b( i, j )
175  250 CONTINUE
176  260 CONTINUE
177  ELSE
178  DO 280 j = 1, m
179  DO 270 i = 1, n
180  b( i, j ) = alpha * conjg( a( j, i ) ) + b( i, j )
181  270 CONTINUE
182  280 CONTINUE
183  END IF
184  ELSE
185  IF( beta.EQ.zero ) THEN
186  DO 300 j = 1, m
187  DO 290 i = 1, n
188  b( i, j ) = zero
189  290 CONTINUE
190  300 CONTINUE
191  ELSE IF( beta.NE.one ) THEN
192  DO 320 j = 1, m
193  CALL cscal( n, beta, b( 1, j ), 1 )
194 * DO 310 I = 1, N
195 * B( I, J ) = BETA * B( I, J )
196 * 310 CONTINUE
197  320 CONTINUE
198  END IF
199  END IF
200  END IF
201 *
202  RETURN
203 *
204 * End of CMMTCADD
205 *
206  END
cmmtcadd
subroutine cmmtcadd(M, N, ALPHA, A, LDA, BETA, B, LDB)
Definition: cmmtcadd.f:2