ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
zmmdda.f
Go to the documentation of this file.
1  SUBROUTINE zmmdda( 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 * ZMMDDA performs the following operation:
20 *
21 * A := alpha * A + beta * B,
22 *
23 * where alpha, beta are scalars and A and B are m by n matrices.
24 *
25 * Arguments
26 * =========
27 *
28 * M (local input) INTEGER
29 * On entry, M specifies the number of rows of A and B. M must
30 * be at least zero.
31 *
32 * N (local input) INTEGER
33 * On entry, N specifies the number of columns of A and B.
34 * N must be at least zero.
35 *
36 * ALPHA (local input) COMPLEX*16
37 * On entry, ALPHA specifies the scalar alpha. When ALPHA is
38 * supplied as zero then the local entries of the array A need
39 * not be set on input.
40 *
41 * A (local input/local output) COMPLEX*16 array
42 * On entry, A is an array of dimension ( LDA, N ). On exit, the
43 * leading m by n part of B has been added to the leading m by n
44 * part of A.
45 *
46 * LDA (local input) INTEGER
47 * On entry, LDA specifies the leading dimension of the array A.
48 * LDA must be at least max( 1, M ).
49 *
50 * BETA (local input) COMPLEX*16
51 * On entry, BETA specifies the scalar beta. When BETA is sup-
52 * plied as zero then the local entries of the array B need not
53 * be set on input.
54 *
55 * B (local input) COMPLEX*16 array
56 * On entry, B is an array of dimension ( LDB, N ).
57 *
58 * LDB (local input) INTEGER
59 * On entry, LDB specifies the leading dimension of the array B.
60 * LDB must be at least max( 1, M ).
61 *
62 * -- Written on April 1, 1998 by
63 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
64 *
65 * =====================================================================
66 *
67 * .. Parameters ..
68  COMPLEX*16 ONE, ZERO
69  parameter( one = ( 1.0d+0, 0.0d+0 ),
70  $ zero = ( 0.0d+0, 0.0d+0 ) )
71 * ..
72 * .. Local Scalars ..
73  INTEGER I, J
74 * ..
75 * .. External Subroutines ..
76  EXTERNAL zaxpy, zcopy, zscal
77 * ..
78 * .. Executable Statements ..
79 *
80  IF( beta.EQ.one ) THEN
81  IF( alpha.EQ.zero ) THEN
82  DO 20 j = 1, n
83  CALL zcopy( m, b( 1, j ), 1, a( 1, j ), 1 )
84 * DO 10 I = 1, M
85 * A( I, J ) = B( I, J )
86 * 10 CONTINUE
87  20 CONTINUE
88  ELSE IF( alpha.NE.one ) THEN
89  DO 40 j = 1, n
90  DO 30 i = 1, m
91  a( i, j ) = b( i, j ) + alpha * a( i, j )
92  30 CONTINUE
93  40 CONTINUE
94  ELSE
95  DO 60 j = 1, n
96  CALL zaxpy( m, one, b( 1, j ), 1, a( 1, j ), 1 )
97 * DO 50 I = 1, M
98 * A( I, J ) = B( I, J ) + A( I, J )
99 * 50 CONTINUE
100  60 CONTINUE
101  END IF
102  ELSE IF( beta.NE.zero ) THEN
103  IF( alpha.EQ.zero ) THEN
104  DO 80 j = 1, n
105  DO 70 i = 1, m
106  a( i, j ) = beta * b( i, j )
107  70 CONTINUE
108  80 CONTINUE
109  ELSE IF( alpha.NE.one ) THEN
110  DO 100 j = 1, n
111  DO 90 i = 1, m
112  a( i, j ) = beta * b( i, j ) + alpha * a( i, j )
113  90 CONTINUE
114  100 CONTINUE
115  ELSE
116  DO 120 j = 1, n
117  CALL zaxpy( m, beta, b( 1, j ), 1, a( 1, j ), 1 )
118 * DO 110 I = 1, M
119 * A( I, J ) = BETA * B( I, J ) + A( I, J )
120 * 110 CONTINUE
121  120 CONTINUE
122  END IF
123  ELSE
124  IF( alpha.EQ.zero ) THEN
125  DO 140 j = 1, n
126  DO 130 i = 1, m
127  a( i, j ) = zero
128  130 CONTINUE
129  140 CONTINUE
130  ELSE IF( alpha.NE.one ) THEN
131  DO 160 j = 1, n
132  CALL zscal( m, alpha, a( 1, j ), 1 )
133 * DO 150 I = 1, M
134 * A( I, J ) = ALPHA * A( I, J )
135 * 150 CONTINUE
136  160 CONTINUE
137  END IF
138  END IF
139 *
140  RETURN
141 *
142 * End of ZMMDDA
143 *
144  END
zmmdda
subroutine zmmdda(M, N, ALPHA, A, LDA, BETA, B, LDB)
Definition: zmmdda.f:2