ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
immtadd.f
Go to the documentation of this file.
1  SUBROUTINE immtadd( 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  INTEGER ALPHA, BETA
11 * ..
12 * .. Array Arguments ..
13  INTEGER A( LDA, * ), B( LDB, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * IMMTADD performs the following operation:
20 *
21 * B := 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) INTEGER
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) INTEGER 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) INTEGER
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) INTEGER 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 added to the leading n by m
57 * 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  INTEGER ONE, ZERO
70  parameter( one = 1, zero = 0 )
71 * ..
72 * .. Local Scalars ..
73  INTEGER I, J
74 * ..
75 * .. Executable Statements ..
76 *
77  IF( m.GE.n ) THEN
78  IF( alpha.EQ.one ) THEN
79  IF( beta.EQ.zero ) THEN
80  DO 20 j = 1, n
81  DO 10 i = 1, m
82  b( j, i ) = a( i, j )
83  10 CONTINUE
84  20 CONTINUE
85  ELSE IF( beta.NE.one ) THEN
86  DO 40 j = 1, n
87  DO 30 i = 1, m
88  b( j, i ) = a( i, j ) + beta * b( j, i )
89  30 CONTINUE
90  40 CONTINUE
91  ELSE
92  DO 60 j = 1, n
93  DO 50 i = 1, m
94  b( j, i ) = a( i, j ) + b( j, i )
95  50 CONTINUE
96  60 CONTINUE
97  END IF
98  ELSE IF( alpha.NE.zero ) THEN
99  IF( beta.EQ.zero ) THEN
100  DO 80 j = 1, n
101  DO 70 i = 1, m
102  b( j, i ) = alpha * a( i, j )
103  70 CONTINUE
104  80 CONTINUE
105  ELSE IF( beta.NE.one ) THEN
106  DO 100 j = 1, n
107  DO 90 i = 1, m
108  b( j, i ) = alpha * a( i, j ) + beta * b( j, i )
109  90 CONTINUE
110  100 CONTINUE
111  ELSE
112  DO 120 j = 1, n
113  DO 110 i = 1, m
114  b( j, i ) = alpha * a( i, j ) + b( j, i )
115  110 CONTINUE
116  120 CONTINUE
117  END IF
118  ELSE
119  IF( beta.EQ.zero ) THEN
120  DO 140 j = 1, m
121  DO 130 i = 1, n
122  b( i, j ) = zero
123  130 CONTINUE
124  140 CONTINUE
125  ELSE IF( beta.NE.one ) THEN
126  DO 160 j = 1, m
127  DO 150 i = 1, n
128  b( i, j ) = beta * b( i, j )
129  150 CONTINUE
130  160 CONTINUE
131  END IF
132  END IF
133  ELSE
134  IF( alpha.EQ.one ) THEN
135  IF( beta.EQ.zero ) THEN
136  DO 180 j = 1, m
137  DO 170 i = 1, n
138  b( i, j ) = a( j, i )
139  170 CONTINUE
140  180 CONTINUE
141  ELSE IF( beta.NE.one ) THEN
142  DO 200 j = 1, m
143  DO 190 i = 1, n
144  b( i, j ) = a( j, i ) + beta * b( i, j )
145  190 CONTINUE
146  200 CONTINUE
147  ELSE
148  DO 220 j = 1, m
149  DO 210 i = 1, n
150  b( i, j ) = a( j, i ) + b( i, j )
151  210 CONTINUE
152  220 CONTINUE
153  END IF
154  ELSE IF( alpha.NE.zero ) THEN
155  IF( beta.EQ.zero ) THEN
156  DO 240 j = 1, m
157  DO 230 i = 1, n
158  b( i, j ) = alpha * a( j, i )
159  230 CONTINUE
160  240 CONTINUE
161  ELSE IF( beta.NE.one ) THEN
162  DO 260 j = 1, m
163  DO 250 i = 1, n
164  b( i, j ) = alpha * a( j, i ) + beta * b( i, j )
165  250 CONTINUE
166  260 CONTINUE
167  ELSE
168  DO 280 j = 1, m
169  DO 270 i = 1, n
170  b( i, j ) = alpha * a( j, i ) + b( i, j )
171  270 CONTINUE
172  280 CONTINUE
173  END IF
174  ELSE
175  IF( beta.EQ.zero ) THEN
176  DO 300 j = 1, m
177  DO 290 i = 1, n
178  b( i, j ) = zero
179  290 CONTINUE
180  300 CONTINUE
181  ELSE IF( beta.NE.one ) THEN
182  DO 320 j = 1, m
183  DO 310 i = 1, n
184  b( i, j ) = beta * b( i, j )
185  310 CONTINUE
186  320 CONTINUE
187  END IF
188  END IF
189  END IF
190 *
191  RETURN
192 *
193 * End of IMMTADD
194 *
195  END
immtadd
subroutine immtadd(M, N, ALPHA, A, LDA, BETA, B, LDB)
Definition: immtadd.f:2