ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
zmmcadd.f
Go to the documentation of this file.
1  SUBROUTINE zmmcadd( 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 * ZMMCADD performs the following operation:
20 *
21 * B := alpha * conjg( 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) COMPLEX*16 array
42 * On entry, A is an array of dimension ( LDA, N ).
43 *
44 * LDA (local input) INTEGER
45 * On entry, LDA specifies the leading dimension of the array A.
46 * LDA must be at least max( 1, M ).
47 *
48 * BETA (local input) COMPLEX*16
49 * On entry, BETA specifies the scalar beta. When BETA is sup-
50 * plied as zero then the local entries of the array B need not
51 * be set on input.
52 *
53 * B (local input/local output) COMPLEX*16 array
54 * On entry, B is an array of dimension ( LDB, N ). On exit, the
55 * leading m by n part of A has been conjugated and added to the
56 * leading m by n part of B.
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 zscal
77 * ..
78 * .. Intrinsic Functions ..
79  INTRINSIC dconjg
80 * ..
81 * .. Executable Statements ..
82 *
83  IF( alpha.EQ.one ) THEN
84  IF( beta.EQ.zero ) THEN
85  DO 20 j = 1, n
86  DO 10 i = 1, m
87  b( i, j ) = dconjg( a( i, j ) )
88  10 CONTINUE
89  20 CONTINUE
90  ELSE IF( beta.NE.one ) THEN
91  DO 40 j = 1, n
92  DO 30 i = 1, m
93  b( i, j ) = dconjg( a( i, j ) ) + beta * b( i, j )
94  30 CONTINUE
95  40 CONTINUE
96  ELSE
97  DO 60 j = 1, n
98  DO 50 i = 1, m
99  b( i, j ) = dconjg( a( i, j ) ) + b( i, j )
100  50 CONTINUE
101  60 CONTINUE
102  END IF
103  ELSE IF( alpha.NE.zero ) THEN
104  IF( beta.EQ.zero ) THEN
105  DO 80 j = 1, n
106  DO 70 i = 1, m
107  b( i, j ) = alpha * dconjg( a( i, j ) )
108  70 CONTINUE
109  80 CONTINUE
110  ELSE IF( beta.NE.one ) THEN
111  DO 100 j = 1, n
112  DO 90 i = 1, m
113  b( i, j ) = alpha * dconjg( a( i, j ) ) +
114  $ beta * b( i, j )
115  90 CONTINUE
116  100 CONTINUE
117  ELSE
118  DO 120 j = 1, n
119  DO 110 i = 1, m
120  b( i, j ) = alpha * dconjg( a( i, j ) ) + b( i, j )
121  110 CONTINUE
122  120 CONTINUE
123  END IF
124  ELSE
125  IF( beta.EQ.zero ) THEN
126  DO 140 j = 1, n
127  DO 130 i = 1, m
128  b( i, j ) = zero
129  130 CONTINUE
130  140 CONTINUE
131  ELSE IF( beta.NE.one ) THEN
132  DO 160 j = 1, n
133  CALL zscal( m, beta, b( 1, j ), 1 )
134 * DO 150 I = 1, M
135 * B( I, J ) = BETA * B( I, J )
136 * 150 CONTINUE
137  160 CONTINUE
138  END IF
139  END IF
140 *
141  RETURN
142 *
143 * End of ZMMCADD
144 *
145  END
zmmcadd
subroutine zmmcadd(M, N, ALPHA, A, LDA, BETA, B, LDB)
Definition: zmmcadd.f:2