1      SUBROUTINE IMMDDA( 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*  IMMDDA 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) INTEGER
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) INTEGER 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) INTEGER
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) INTEGER 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      INTEGER            ONE, ZERO
69      PARAMETER          ( ONE = 1, ZERO = 0 )
70*     ..
71*     .. Local Scalars ..
72      INTEGER            I, J
73*     ..
74*     .. Executable Statements ..
75*
76      IF( BETA.EQ.ONE ) THEN
77         IF( ALPHA.EQ.ZERO ) THEN
78            DO 20 J = 1, N
79               DO 10 I = 1, M
80                  A( I, J ) = B( I, J )
81   10          CONTINUE
82   20       CONTINUE
83         ELSE IF( ALPHA.NE.ONE ) THEN
84            DO 40 J = 1, N
85               DO 30 I = 1, M
86                  A( I, J ) = B( I, J ) + ALPHA * A( I, J )
87   30          CONTINUE
88   40       CONTINUE
89         ELSE
90            DO 60 J = 1, N
91               DO 50 I = 1, M
92                  A( I, J ) = B( I, J ) + A( I, J )
93   50          CONTINUE
94   60       CONTINUE
95         END IF
96      ELSE IF( BETA.NE.ZERO ) THEN
97         IF( ALPHA.EQ.ZERO ) THEN
98            DO 80 J = 1, N
99               DO 70 I = 1, M
100                  A( I, J ) = BETA * B( I, J )
101   70          CONTINUE
102   80       CONTINUE
103         ELSE IF( ALPHA.NE.ONE ) THEN
104            DO 100 J = 1, N
105               DO 90 I = 1, M
106                  A( I, J ) = BETA * B( I, J ) + ALPHA * A( I, J )
107   90          CONTINUE
108  100       CONTINUE
109         ELSE
110            DO 120 J = 1, N
111               DO 110 I = 1, M
112                  A( I, J ) = BETA * B( I, J ) + A( I, J )
113  110          CONTINUE
114  120       CONTINUE
115         END IF
116      ELSE
117         IF( ALPHA.EQ.ZERO ) THEN
118            DO 140 J = 1, N
119               DO 130 I = 1, M
120                  A( I, J ) = ZERO
121  130          CONTINUE
122  140       CONTINUE
123         ELSE IF( ALPHA.NE.ONE ) THEN
124            DO 160 J = 1, N
125               DO 150 I = 1, M
126                  A( I, J ) = ALPHA * A( I, J )
127  150          CONTINUE
128  160       CONTINUE
129         END IF
130      END IF
131*
132      RETURN
133*
134*     End of IMMDDA
135*
136      END
137