Statistiques
| Révision :

root / src / blas / dsymm.f @ 11

Historique | Voir | Annoter | Télécharger (9,37 ko)

1 1 pfleura2
      SUBROUTINE DSYMM(SIDE,UPLO,M,N,ALPHA,A,LDA,B,LDB,BETA,C,LDC)
2 1 pfleura2
*     .. Scalar Arguments ..
3 1 pfleura2
      DOUBLE PRECISION ALPHA,BETA
4 1 pfleura2
      INTEGER LDA,LDB,LDC,M,N
5 1 pfleura2
      CHARACTER SIDE,UPLO
6 1 pfleura2
*     ..
7 1 pfleura2
*     .. Array Arguments ..
8 1 pfleura2
      DOUBLE PRECISION A(LDA,*),B(LDB,*),C(LDC,*)
9 1 pfleura2
*     ..
10 1 pfleura2
*
11 1 pfleura2
*  Purpose
12 1 pfleura2
*  =======
13 1 pfleura2
*
14 1 pfleura2
*  DSYMM  performs one of the matrix-matrix operations
15 1 pfleura2
*
16 1 pfleura2
*     C := alpha*A*B + beta*C,
17 1 pfleura2
*
18 1 pfleura2
*  or
19 1 pfleura2
*
20 1 pfleura2
*     C := alpha*B*A + beta*C,
21 1 pfleura2
*
22 1 pfleura2
*  where alpha and beta are scalars,  A is a symmetric matrix and  B and
23 1 pfleura2
*  C are  m by n matrices.
24 1 pfleura2
*
25 1 pfleura2
*  Arguments
26 1 pfleura2
*  ==========
27 1 pfleura2
*
28 1 pfleura2
*  SIDE   - CHARACTER*1.
29 1 pfleura2
*           On entry,  SIDE  specifies whether  the  symmetric matrix  A
30 1 pfleura2
*           appears on the  left or right  in the  operation as follows:
31 1 pfleura2
*
32 1 pfleura2
*              SIDE = 'L' or 'l'   C := alpha*A*B + beta*C,
33 1 pfleura2
*
34 1 pfleura2
*              SIDE = 'R' or 'r'   C := alpha*B*A + beta*C,
35 1 pfleura2
*
36 1 pfleura2
*           Unchanged on exit.
37 1 pfleura2
*
38 1 pfleura2
*  UPLO   - CHARACTER*1.
39 1 pfleura2
*           On  entry,   UPLO  specifies  whether  the  upper  or  lower
40 1 pfleura2
*           triangular  part  of  the  symmetric  matrix   A  is  to  be
41 1 pfleura2
*           referenced as follows:
42 1 pfleura2
*
43 1 pfleura2
*              UPLO = 'U' or 'u'   Only the upper triangular part of the
44 1 pfleura2
*                                  symmetric matrix is to be referenced.
45 1 pfleura2
*
46 1 pfleura2
*              UPLO = 'L' or 'l'   Only the lower triangular part of the
47 1 pfleura2
*                                  symmetric matrix is to be referenced.
48 1 pfleura2
*
49 1 pfleura2
*           Unchanged on exit.
50 1 pfleura2
*
51 1 pfleura2
*  M      - INTEGER.
52 1 pfleura2
*           On entry,  M  specifies the number of rows of the matrix  C.
53 1 pfleura2
*           M  must be at least zero.
54 1 pfleura2
*           Unchanged on exit.
55 1 pfleura2
*
56 1 pfleura2
*  N      - INTEGER.
57 1 pfleura2
*           On entry, N specifies the number of columns of the matrix C.
58 1 pfleura2
*           N  must be at least zero.
59 1 pfleura2
*           Unchanged on exit.
60 1 pfleura2
*
61 1 pfleura2
*  ALPHA  - DOUBLE PRECISION.
62 1 pfleura2
*           On entry, ALPHA specifies the scalar alpha.
63 1 pfleura2
*           Unchanged on exit.
64 1 pfleura2
*
65 1 pfleura2
*  A      - DOUBLE PRECISION array of DIMENSION ( LDA, ka ), where ka is
66 1 pfleura2
*           m  when  SIDE = 'L' or 'l'  and is  n otherwise.
67 1 pfleura2
*           Before entry  with  SIDE = 'L' or 'l',  the  m by m  part of
68 1 pfleura2
*           the array  A  must contain the  symmetric matrix,  such that
69 1 pfleura2
*           when  UPLO = 'U' or 'u', the leading m by m upper triangular
70 1 pfleura2
*           part of the array  A  must contain the upper triangular part
71 1 pfleura2
*           of the  symmetric matrix and the  strictly  lower triangular
72 1 pfleura2
*           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
73 1 pfleura2
*           the leading  m by m  lower triangular part  of the  array  A
74 1 pfleura2
*           must  contain  the  lower triangular part  of the  symmetric
75 1 pfleura2
*           matrix and the  strictly upper triangular part of  A  is not
76 1 pfleura2
*           referenced.
77 1 pfleura2
*           Before entry  with  SIDE = 'R' or 'r',  the  n by n  part of
78 1 pfleura2
*           the array  A  must contain the  symmetric matrix,  such that
79 1 pfleura2
*           when  UPLO = 'U' or 'u', the leading n by n upper triangular
80 1 pfleura2
*           part of the array  A  must contain the upper triangular part
81 1 pfleura2
*           of the  symmetric matrix and the  strictly  lower triangular
82 1 pfleura2
*           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
83 1 pfleura2
*           the leading  n by n  lower triangular part  of the  array  A
84 1 pfleura2
*           must  contain  the  lower triangular part  of the  symmetric
85 1 pfleura2
*           matrix and the  strictly upper triangular part of  A  is not
86 1 pfleura2
*           referenced.
87 1 pfleura2
*           Unchanged on exit.
88 1 pfleura2
*
89 1 pfleura2
*  LDA    - INTEGER.
90 1 pfleura2
*           On entry, LDA specifies the first dimension of A as declared
91 1 pfleura2
*           in the calling (sub) program.  When  SIDE = 'L' or 'l'  then
92 1 pfleura2
*           LDA must be at least  max( 1, m ), otherwise  LDA must be at
93 1 pfleura2
*           least  max( 1, n ).
94 1 pfleura2
*           Unchanged on exit.
95 1 pfleura2
*
96 1 pfleura2
*  B      - DOUBLE PRECISION array of DIMENSION ( LDB, n ).
97 1 pfleura2
*           Before entry, the leading  m by n part of the array  B  must
98 1 pfleura2
*           contain the matrix B.
99 1 pfleura2
*           Unchanged on exit.
100 1 pfleura2
*
101 1 pfleura2
*  LDB    - INTEGER.
102 1 pfleura2
*           On entry, LDB specifies the first dimension of B as declared
103 1 pfleura2
*           in  the  calling  (sub)  program.   LDB  must  be  at  least
104 1 pfleura2
*           max( 1, m ).
105 1 pfleura2
*           Unchanged on exit.
106 1 pfleura2
*
107 1 pfleura2
*  BETA   - DOUBLE PRECISION.
108 1 pfleura2
*           On entry,  BETA  specifies the scalar  beta.  When  BETA  is
109 1 pfleura2
*           supplied as zero then C need not be set on input.
110 1 pfleura2
*           Unchanged on exit.
111 1 pfleura2
*
112 1 pfleura2
*  C      - DOUBLE PRECISION array of DIMENSION ( LDC, n ).
113 1 pfleura2
*           Before entry, the leading  m by n  part of the array  C must
114 1 pfleura2
*           contain the matrix  C,  except when  beta  is zero, in which
115 1 pfleura2
*           case C need not be set on entry.
116 1 pfleura2
*           On exit, the array  C  is overwritten by the  m by n updated
117 1 pfleura2
*           matrix.
118 1 pfleura2
*
119 1 pfleura2
*  LDC    - INTEGER.
120 1 pfleura2
*           On entry, LDC specifies the first dimension of C as declared
121 1 pfleura2
*           in  the  calling  (sub)  program.   LDC  must  be  at  least
122 1 pfleura2
*           max( 1, m ).
123 1 pfleura2
*           Unchanged on exit.
124 1 pfleura2
*
125 1 pfleura2
*
126 1 pfleura2
*  Level 3 Blas routine.
127 1 pfleura2
*
128 1 pfleura2
*  -- Written on 8-February-1989.
129 1 pfleura2
*     Jack Dongarra, Argonne National Laboratory.
130 1 pfleura2
*     Iain Duff, AERE Harwell.
131 1 pfleura2
*     Jeremy Du Croz, Numerical Algorithms Group Ltd.
132 1 pfleura2
*     Sven Hammarling, Numerical Algorithms Group Ltd.
133 1 pfleura2
*
134 1 pfleura2
*
135 1 pfleura2
*     .. External Functions ..
136 1 pfleura2
      LOGICAL LSAME
137 1 pfleura2
      EXTERNAL LSAME
138 1 pfleura2
*     ..
139 1 pfleura2
*     .. External Subroutines ..
140 1 pfleura2
      EXTERNAL XERBLA
141 1 pfleura2
*     ..
142 1 pfleura2
*     .. Intrinsic Functions ..
143 1 pfleura2
      INTRINSIC MAX
144 1 pfleura2
*     ..
145 1 pfleura2
*     .. Local Scalars ..
146 1 pfleura2
      DOUBLE PRECISION TEMP1,TEMP2
147 1 pfleura2
      INTEGER I,INFO,J,K,NROWA
148 1 pfleura2
      LOGICAL UPPER
149 1 pfleura2
*     ..
150 1 pfleura2
*     .. Parameters ..
151 1 pfleura2
      DOUBLE PRECISION ONE,ZERO
152 1 pfleura2
      PARAMETER (ONE=1.0D+0,ZERO=0.0D+0)
153 1 pfleura2
*     ..
154 1 pfleura2
*
155 1 pfleura2
*     Set NROWA as the number of rows of A.
156 1 pfleura2
*
157 1 pfleura2
      IF (LSAME(SIDE,'L')) THEN
158 1 pfleura2
          NROWA = M
159 1 pfleura2
      ELSE
160 1 pfleura2
          NROWA = N
161 1 pfleura2
      END IF
162 1 pfleura2
      UPPER = LSAME(UPLO,'U')
163 1 pfleura2
*
164 1 pfleura2
*     Test the input parameters.
165 1 pfleura2
*
166 1 pfleura2
      INFO = 0
167 1 pfleura2
      IF ((.NOT.LSAME(SIDE,'L')) .AND. (.NOT.LSAME(SIDE,'R'))) THEN
168 1 pfleura2
          INFO = 1
169 1 pfleura2
      ELSE IF ((.NOT.UPPER) .AND. (.NOT.LSAME(UPLO,'L'))) THEN
170 1 pfleura2
          INFO = 2
171 1 pfleura2
      ELSE IF (M.LT.0) THEN
172 1 pfleura2
          INFO = 3
173 1 pfleura2
      ELSE IF (N.LT.0) THEN
174 1 pfleura2
          INFO = 4
175 1 pfleura2
      ELSE IF (LDA.LT.MAX(1,NROWA)) THEN
176 1 pfleura2
          INFO = 7
177 1 pfleura2
      ELSE IF (LDB.LT.MAX(1,M)) THEN
178 1 pfleura2
          INFO = 9
179 1 pfleura2
      ELSE IF (LDC.LT.MAX(1,M)) THEN
180 1 pfleura2
          INFO = 12
181 1 pfleura2
      END IF
182 1 pfleura2
      IF (INFO.NE.0) THEN
183 1 pfleura2
          CALL XERBLA('DSYMM ',INFO)
184 1 pfleura2
          RETURN
185 1 pfleura2
      END IF
186 1 pfleura2
*
187 1 pfleura2
*     Quick return if possible.
188 1 pfleura2
*
189 1 pfleura2
      IF ((M.EQ.0) .OR. (N.EQ.0) .OR.
190 1 pfleura2
     +    ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
191 1 pfleura2
*
192 1 pfleura2
*     And when  alpha.eq.zero.
193 1 pfleura2
*
194 1 pfleura2
      IF (ALPHA.EQ.ZERO) THEN
195 1 pfleura2
          IF (BETA.EQ.ZERO) THEN
196 1 pfleura2
              DO 20 J = 1,N
197 1 pfleura2
                  DO 10 I = 1,M
198 1 pfleura2
                      C(I,J) = ZERO
199 1 pfleura2
   10             CONTINUE
200 1 pfleura2
   20         CONTINUE
201 1 pfleura2
          ELSE
202 1 pfleura2
              DO 40 J = 1,N
203 1 pfleura2
                  DO 30 I = 1,M
204 1 pfleura2
                      C(I,J) = BETA*C(I,J)
205 1 pfleura2
   30             CONTINUE
206 1 pfleura2
   40         CONTINUE
207 1 pfleura2
          END IF
208 1 pfleura2
          RETURN
209 1 pfleura2
      END IF
210 1 pfleura2
*
211 1 pfleura2
*     Start the operations.
212 1 pfleura2
*
213 1 pfleura2
      IF (LSAME(SIDE,'L')) THEN
214 1 pfleura2
*
215 1 pfleura2
*        Form  C := alpha*A*B + beta*C.
216 1 pfleura2
*
217 1 pfleura2
          IF (UPPER) THEN
218 1 pfleura2
              DO 70 J = 1,N
219 1 pfleura2
                  DO 60 I = 1,M
220 1 pfleura2
                      TEMP1 = ALPHA*B(I,J)
221 1 pfleura2
                      TEMP2 = ZERO
222 1 pfleura2
                      DO 50 K = 1,I - 1
223 1 pfleura2
                          C(K,J) = C(K,J) + TEMP1*A(K,I)
224 1 pfleura2
                          TEMP2 = TEMP2 + B(K,J)*A(K,I)
225 1 pfleura2
   50                 CONTINUE
226 1 pfleura2
                      IF (BETA.EQ.ZERO) THEN
227 1 pfleura2
                          C(I,J) = TEMP1*A(I,I) + ALPHA*TEMP2
228 1 pfleura2
                      ELSE
229 1 pfleura2
                          C(I,J) = BETA*C(I,J) + TEMP1*A(I,I) +
230 1 pfleura2
     +                             ALPHA*TEMP2
231 1 pfleura2
                      END IF
232 1 pfleura2
   60             CONTINUE
233 1 pfleura2
   70         CONTINUE
234 1 pfleura2
          ELSE
235 1 pfleura2
              DO 100 J = 1,N
236 1 pfleura2
                  DO 90 I = M,1,-1
237 1 pfleura2
                      TEMP1 = ALPHA*B(I,J)
238 1 pfleura2
                      TEMP2 = ZERO
239 1 pfleura2
                      DO 80 K = I + 1,M
240 1 pfleura2
                          C(K,J) = C(K,J) + TEMP1*A(K,I)
241 1 pfleura2
                          TEMP2 = TEMP2 + B(K,J)*A(K,I)
242 1 pfleura2
   80                 CONTINUE
243 1 pfleura2
                      IF (BETA.EQ.ZERO) THEN
244 1 pfleura2
                          C(I,J) = TEMP1*A(I,I) + ALPHA*TEMP2
245 1 pfleura2
                      ELSE
246 1 pfleura2
                          C(I,J) = BETA*C(I,J) + TEMP1*A(I,I) +
247 1 pfleura2
     +                             ALPHA*TEMP2
248 1 pfleura2
                      END IF
249 1 pfleura2
   90             CONTINUE
250 1 pfleura2
  100         CONTINUE
251 1 pfleura2
          END IF
252 1 pfleura2
      ELSE
253 1 pfleura2
*
254 1 pfleura2
*        Form  C := alpha*B*A + beta*C.
255 1 pfleura2
*
256 1 pfleura2
          DO 170 J = 1,N
257 1 pfleura2
              TEMP1 = ALPHA*A(J,J)
258 1 pfleura2
              IF (BETA.EQ.ZERO) THEN
259 1 pfleura2
                  DO 110 I = 1,M
260 1 pfleura2
                      C(I,J) = TEMP1*B(I,J)
261 1 pfleura2
  110             CONTINUE
262 1 pfleura2
              ELSE
263 1 pfleura2
                  DO 120 I = 1,M
264 1 pfleura2
                      C(I,J) = BETA*C(I,J) + TEMP1*B(I,J)
265 1 pfleura2
  120             CONTINUE
266 1 pfleura2
              END IF
267 1 pfleura2
              DO 140 K = 1,J - 1
268 1 pfleura2
                  IF (UPPER) THEN
269 1 pfleura2
                      TEMP1 = ALPHA*A(K,J)
270 1 pfleura2
                  ELSE
271 1 pfleura2
                      TEMP1 = ALPHA*A(J,K)
272 1 pfleura2
                  END IF
273 1 pfleura2
                  DO 130 I = 1,M
274 1 pfleura2
                      C(I,J) = C(I,J) + TEMP1*B(I,K)
275 1 pfleura2
  130             CONTINUE
276 1 pfleura2
  140         CONTINUE
277 1 pfleura2
              DO 160 K = J + 1,N
278 1 pfleura2
                  IF (UPPER) THEN
279 1 pfleura2
                      TEMP1 = ALPHA*A(J,K)
280 1 pfleura2
                  ELSE
281 1 pfleura2
                      TEMP1 = ALPHA*A(K,J)
282 1 pfleura2
                  END IF
283 1 pfleura2
                  DO 150 I = 1,M
284 1 pfleura2
                      C(I,J) = C(I,J) + TEMP1*B(I,K)
285 1 pfleura2
  150             CONTINUE
286 1 pfleura2
  160         CONTINUE
287 1 pfleura2
  170     CONTINUE
288 1 pfleura2
      END IF
289 1 pfleura2
*
290 1 pfleura2
      RETURN
291 1 pfleura2
*
292 1 pfleura2
*     End of DSYMM .
293 1 pfleura2
*
294 1 pfleura2
      END