LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ chemm()

subroutine chemm ( character  SIDE,
character  UPLO,
integer  M,
integer  N,
complex  ALPHA,
complex, dimension(lda,*)  A,
integer  LDA,
complex, dimension(ldb,*)  B,
integer  LDB,
complex  BETA,
complex, dimension(ldc,*)  C,
integer  LDC 
)

CHEMM

Purpose:
 CHEMM  performs one of the matrix-matrix operations

    C := alpha*A*B + beta*C,

 or

    C := alpha*B*A + beta*C,

 where alpha and beta are scalars, A is an hermitian matrix and  B and
 C are m by n matrices.
Parameters
[in]SIDE
          SIDE is CHARACTER*1
           On entry,  SIDE  specifies whether  the  hermitian matrix  A
           appears on the  left or right  in the  operation as follows:

              SIDE = 'L' or 'l'   C := alpha*A*B + beta*C,

              SIDE = 'R' or 'r'   C := alpha*B*A + beta*C,
[in]UPLO
          UPLO is CHARACTER*1
           On  entry,   UPLO  specifies  whether  the  upper  or  lower
           triangular  part  of  the  hermitian  matrix   A  is  to  be
           referenced as follows:

              UPLO = 'U' or 'u'   Only the upper triangular part of the
                                  hermitian matrix is to be referenced.

              UPLO = 'L' or 'l'   Only the lower triangular part of the
                                  hermitian matrix is to be referenced.
[in]M
          M is INTEGER
           On entry,  M  specifies the number of rows of the matrix  C.
           M  must be at least zero.
[in]N
          N is INTEGER
           On entry, N specifies the number of columns of the matrix C.
           N  must be at least zero.
[in]ALPHA
          ALPHA is COMPLEX
           On entry, ALPHA specifies the scalar alpha.
[in]A
          A is COMPLEX array, dimension ( LDA, ka ), where ka is
           m  when  SIDE = 'L' or 'l'  and is n  otherwise.
           Before entry  with  SIDE = 'L' or 'l',  the  m by m  part of
           the array  A  must contain the  hermitian matrix,  such that
           when  UPLO = 'U' or 'u', the leading m by m upper triangular
           part of the array  A  must contain the upper triangular part
           of the  hermitian matrix and the  strictly  lower triangular
           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
           the leading  m by m  lower triangular part  of the  array  A
           must  contain  the  lower triangular part  of the  hermitian
           matrix and the  strictly upper triangular part of  A  is not
           referenced.
           Before entry  with  SIDE = 'R' or 'r',  the  n by n  part of
           the array  A  must contain the  hermitian matrix,  such that
           when  UPLO = 'U' or 'u', the leading n by n upper triangular
           part of the array  A  must contain the upper triangular part
           of the  hermitian matrix and the  strictly  lower triangular
           part of  A  is not referenced,  and when  UPLO = 'L' or 'l',
           the leading  n by n  lower triangular part  of the  array  A
           must  contain  the  lower triangular part  of the  hermitian
           matrix and the  strictly upper triangular part of  A  is not
           referenced.
           Note that the imaginary parts  of the diagonal elements need
           not be set, they are assumed to be zero.
[in]LDA
          LDA is INTEGER
           On entry, LDA specifies the first dimension of A as declared
           in the  calling (sub) program. When  SIDE = 'L' or 'l'  then
           LDA must be at least  max( 1, m ), otherwise  LDA must be at
           least max( 1, n ).
[in]B
          B is COMPLEX array, dimension ( LDB, N )
           Before entry, the leading  m by n part of the array  B  must
           contain the matrix B.
[in]LDB
          LDB is INTEGER
           On entry, LDB specifies the first dimension of B as declared
           in  the  calling  (sub)  program.   LDB  must  be  at  least
           max( 1, m ).
[in]BETA
          BETA is COMPLEX
           On entry,  BETA  specifies the scalar  beta.  When  BETA  is
           supplied as zero then C need not be set on input.
[in,out]C
          C is COMPLEX array, dimension ( LDC, N )
           Before entry, the leading  m by n  part of the array  C must
           contain the matrix  C,  except when  beta  is zero, in which
           case C need not be set on entry.
           On exit, the array  C  is overwritten by the  m by n updated
           matrix.
[in]LDC
          LDC is INTEGER
           On entry, LDC specifies the first dimension of C as declared
           in  the  calling  (sub)  program.   LDC  must  be  at  least
           max( 1, m ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
  Level 3 Blas routine.

  -- Written on 8-February-1989.
     Jack Dongarra, Argonne National Laboratory.
     Iain Duff, AERE Harwell.
     Jeremy Du Croz, Numerical Algorithms Group Ltd.
     Sven Hammarling, Numerical Algorithms Group Ltd.

Definition at line 190 of file chemm.f.

191*
192* -- Reference BLAS level3 routine --
193* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
194* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
195*
196* .. Scalar Arguments ..
197 COMPLEX ALPHA,BETA
198 INTEGER LDA,LDB,LDC,M,N
199 CHARACTER SIDE,UPLO
200* ..
201* .. Array Arguments ..
202 COMPLEX A(LDA,*),B(LDB,*),C(LDC,*)
203* ..
204*
205* =====================================================================
206*
207* .. External Functions ..
208 LOGICAL LSAME
209 EXTERNAL lsame
210* ..
211* .. External Subroutines ..
212 EXTERNAL xerbla
213* ..
214* .. Intrinsic Functions ..
215 INTRINSIC conjg,max,real
216* ..
217* .. Local Scalars ..
218 COMPLEX TEMP1,TEMP2
219 INTEGER I,INFO,J,K,NROWA
220 LOGICAL UPPER
221* ..
222* .. Parameters ..
223 COMPLEX ONE
224 parameter(one= (1.0e+0,0.0e+0))
225 COMPLEX ZERO
226 parameter(zero= (0.0e+0,0.0e+0))
227* ..
228*
229* Set NROWA as the number of rows of A.
230*
231 IF (lsame(side,'L')) THEN
232 nrowa = m
233 ELSE
234 nrowa = n
235 END IF
236 upper = lsame(uplo,'U')
237*
238* Test the input parameters.
239*
240 info = 0
241 IF ((.NOT.lsame(side,'L')) .AND. (.NOT.lsame(side,'R'))) THEN
242 info = 1
243 ELSE IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
244 info = 2
245 ELSE IF (m.LT.0) THEN
246 info = 3
247 ELSE IF (n.LT.0) THEN
248 info = 4
249 ELSE IF (lda.LT.max(1,nrowa)) THEN
250 info = 7
251 ELSE IF (ldb.LT.max(1,m)) THEN
252 info = 9
253 ELSE IF (ldc.LT.max(1,m)) THEN
254 info = 12
255 END IF
256 IF (info.NE.0) THEN
257 CALL xerbla('CHEMM ',info)
258 RETURN
259 END IF
260*
261* Quick return if possible.
262*
263 IF ((m.EQ.0) .OR. (n.EQ.0) .OR.
264 + ((alpha.EQ.zero).AND. (beta.EQ.one))) RETURN
265*
266* And when alpha.eq.zero.
267*
268 IF (alpha.EQ.zero) THEN
269 IF (beta.EQ.zero) THEN
270 DO 20 j = 1,n
271 DO 10 i = 1,m
272 c(i,j) = zero
273 10 CONTINUE
274 20 CONTINUE
275 ELSE
276 DO 40 j = 1,n
277 DO 30 i = 1,m
278 c(i,j) = beta*c(i,j)
279 30 CONTINUE
280 40 CONTINUE
281 END IF
282 RETURN
283 END IF
284*
285* Start the operations.
286*
287 IF (lsame(side,'L')) THEN
288*
289* Form C := alpha*A*B + beta*C.
290*
291 IF (upper) THEN
292 DO 70 j = 1,n
293 DO 60 i = 1,m
294 temp1 = alpha*b(i,j)
295 temp2 = zero
296 DO 50 k = 1,i - 1
297 c(k,j) = c(k,j) + temp1*a(k,i)
298 temp2 = temp2 + b(k,j)*conjg(a(k,i))
299 50 CONTINUE
300 IF (beta.EQ.zero) THEN
301 c(i,j) = temp1*real(a(i,i)) + alpha*temp2
302 ELSE
303 c(i,j) = beta*c(i,j) + temp1*real(a(i,i)) +
304 + alpha*temp2
305 END IF
306 60 CONTINUE
307 70 CONTINUE
308 ELSE
309 DO 100 j = 1,n
310 DO 90 i = m,1,-1
311 temp1 = alpha*b(i,j)
312 temp2 = zero
313 DO 80 k = i + 1,m
314 c(k,j) = c(k,j) + temp1*a(k,i)
315 temp2 = temp2 + b(k,j)*conjg(a(k,i))
316 80 CONTINUE
317 IF (beta.EQ.zero) THEN
318 c(i,j) = temp1*real(a(i,i)) + alpha*temp2
319 ELSE
320 c(i,j) = beta*c(i,j) + temp1*real(a(i,i)) +
321 + alpha*temp2
322 END IF
323 90 CONTINUE
324 100 CONTINUE
325 END IF
326 ELSE
327*
328* Form C := alpha*B*A + beta*C.
329*
330 DO 170 j = 1,n
331 temp1 = alpha*real(a(j,j))
332 IF (beta.EQ.zero) THEN
333 DO 110 i = 1,m
334 c(i,j) = temp1*b(i,j)
335 110 CONTINUE
336 ELSE
337 DO 120 i = 1,m
338 c(i,j) = beta*c(i,j) + temp1*b(i,j)
339 120 CONTINUE
340 END IF
341 DO 140 k = 1,j - 1
342 IF (upper) THEN
343 temp1 = alpha*a(k,j)
344 ELSE
345 temp1 = alpha*conjg(a(j,k))
346 END IF
347 DO 130 i = 1,m
348 c(i,j) = c(i,j) + temp1*b(i,k)
349 130 CONTINUE
350 140 CONTINUE
351 DO 160 k = j + 1,n
352 IF (upper) THEN
353 temp1 = alpha*conjg(a(j,k))
354 ELSE
355 temp1 = alpha*a(k,j)
356 END IF
357 DO 150 i = 1,m
358 c(i,j) = c(i,j) + temp1*b(i,k)
359 150 CONTINUE
360 160 CONTINUE
361 170 CONTINUE
362 END IF
363*
364 RETURN
365*
366* End of CHEMM
367*
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:53
Here is the call graph for this function:
Here is the caller graph for this function: