ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
zmmddat.f
Go to the documentation of this file.
1  SUBROUTINE zmmddat( 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*16 ALPHA, BETA
11 * ..
12 * .. Array Arguments ..
13  COMPLEX*16 A( LDA, * ), B( LDB, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * ZMMDDAT performs the following operation:
20 *
21 * A := alpha * 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*16
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/local output) COMPLEX*16 array
43 * On entry, A is an array of dimension ( LDA, N ). On exit, the
44 * leading n by m part of B has been added to the leading m by n
45 * part of A.
46 *
47 * LDA (local input) INTEGER
48 * On entry, LDA specifies the leading dimension of the array A.
49 * LDA must be at least max( 1, M ).
50 *
51 * BETA (local input) COMPLEX*16
52 * On entry, BETA specifies the scalar beta. When BETA is sup-
53 * plied as zero then the local entries of the array B need not
54 * be set on input.
55 *
56 * B (local input) COMPLEX*16 array
57 * On entry, B is an array of dimension ( LDB, M ).
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*16 ONE, ZERO
70  parameter( one = ( 1.0d+0, 0.0d+0 ),
71  $ zero = ( 0.0d+0, 0.0d+0 ) )
72 * ..
73 * .. Local Scalars ..
74  INTEGER I, J
75 * ..
76 * .. External Subroutines ..
77  EXTERNAL zaxpy, zcopy, zscal
78 * ..
79 * .. Executable Statements ..
80 *
81  IF( m.GE.n ) THEN
82  IF( beta.EQ.one ) THEN
83  IF( alpha.EQ.zero ) THEN
84  DO 20 j = 1, n
85  CALL zcopy( m, b( j, 1 ), ldb, a( 1, j ), 1 )
86 * DO 10 I = 1, M
87 * A( I, J ) = B( J, I )
88 * 10 CONTINUE
89  20 CONTINUE
90  ELSE IF( alpha.NE.one ) THEN
91  DO 40 j = 1, n
92  DO 30 i = 1, m
93  a( i, j ) = b( j, i ) + alpha * a( i, j )
94  30 CONTINUE
95  40 CONTINUE
96  ELSE
97  DO 60 j = 1, n
98  CALL zaxpy( m, one, b( j, 1 ), ldb, a( 1, j ), 1 )
99 * DO 50 I = 1, M
100 * A( I, J ) = B( J, I ) + A( I, J )
101 * 50 CONTINUE
102  60 CONTINUE
103  END IF
104  ELSE IF( beta.NE.zero ) THEN
105  IF( alpha.EQ.zero ) THEN
106  DO 80 j = 1, n
107  DO 70 i = 1, m
108  a( i, j ) = beta * b( j, i )
109  70 CONTINUE
110  80 CONTINUE
111  ELSE IF( alpha.NE.one ) THEN
112  DO 100 j = 1, n
113  DO 90 i = 1, m
114  a( i, j ) = beta * b( j, i ) + alpha * a( i, j )
115  90 CONTINUE
116  100 CONTINUE
117  ELSE
118  DO 120 j = 1, n
119  CALL zaxpy( m, beta, b( j, 1 ), ldb, a( 1, j ), 1 )
120 * DO 110 I = 1, M
121 * A( I, J ) = BETA * B( J, I ) + A( I, J )
122 * 110 CONTINUE
123  120 CONTINUE
124  END IF
125  ELSE
126  IF( alpha.EQ.zero ) THEN
127  DO 140 j = 1, n
128  DO 130 i = 1, m
129  a( i, j ) = zero
130  130 CONTINUE
131  140 CONTINUE
132  ELSE IF( alpha.NE.one ) THEN
133  DO 160 j = 1, n
134  CALL zscal( m, alpha, a( 1, j ), 1 )
135 * DO 150 I = 1, M
136 * A( I, J ) = ALPHA * A( I, J )
137 * 150 CONTINUE
138  160 CONTINUE
139  END IF
140  END IF
141  ELSE
142  IF( beta.EQ.one ) THEN
143  IF( alpha.EQ.zero ) THEN
144  DO 180 j = 1, m
145  CALL zcopy( n, b( 1, j ), 1, a( j, 1 ), lda )
146 * DO 170 I = 1, N
147 * A( J, I ) = B( I, J )
148 * 170 CONTINUE
149  180 CONTINUE
150  ELSE IF( alpha.NE.one ) THEN
151  DO 200 j = 1, m
152  DO 190 i = 1, n
153  a( j, i ) = b( i, j ) + alpha * a( j, i )
154  190 CONTINUE
155  200 CONTINUE
156  ELSE
157  DO 220 j = 1, m
158  CALL zaxpy( n, one, b( 1, j ), 1, a( j, 1 ), lda )
159 * DO 210 I = 1, N
160 * A( J, I ) = B( I, J ) + A( J, I )
161 * 210 CONTINUE
162  220 CONTINUE
163  END IF
164  ELSE IF( beta.NE.zero ) THEN
165  IF( alpha.EQ.zero ) THEN
166  DO 240 j = 1, m
167  DO 230 i = 1, n
168  a( j, i ) = beta * b( i, j )
169  230 CONTINUE
170  240 CONTINUE
171  ELSE IF( alpha.NE.one ) THEN
172  DO 260 j = 1, m
173  DO 250 i = 1, n
174  a( j, i ) = beta * b( i, j ) + alpha * a( j, i )
175  250 CONTINUE
176  260 CONTINUE
177  ELSE
178  DO 280 j = 1, m
179  CALL zaxpy( n, beta, b( 1, j ), 1, a( j, 1 ), lda )
180 * DO 270 I = 1, N
181 * A( J, I ) = BETA * B( I, J ) + A( J, I )
182 * 270 CONTINUE
183  280 CONTINUE
184  END IF
185  ELSE
186  IF( alpha.EQ.zero ) THEN
187  DO 300 j = 1, n
188  DO 290 i = 1, m
189  a( i, j ) = zero
190  290 CONTINUE
191  300 CONTINUE
192  ELSE IF( alpha.NE.one ) THEN
193  DO 320 j = 1, n
194  CALL zscal( m, alpha, a( 1, j ), 1 )
195 * DO 310 I = 1, M
196 * A( I, J ) = ALPHA * A( I, J )
197 * 310 CONTINUE
198  320 CONTINUE
199  END IF
200  END IF
201  END IF
202 *
203  RETURN
204 *
205 * End of ZMMDDAT
206 *
207  END
zmmddat
subroutine zmmddat(M, N, ALPHA, A, LDA, BETA, B, LDB)
Definition: zmmddat.f:2