          SEARCH  NEW RPMS  DIRECTORIES  ABOUT  FAQ  VARIOUS  BLOG  DONATE  YUM REPOSITORY    MAN page from openSUSE Leap 42 blas-man-3.5.0-9.1.noarch.rpm

# cher2k.f

Section: LAPACK (3)
Updated: Fri Nov 4 2016
Index

cher2k.f -

## SYNOPSIS

### Functions/Subroutines

subroutine CHER2K (UPLO, TRANS, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHER2K

## Function/Subroutine Documentation

### subroutine CHER2K (character UPLO, character TRANS, integer N, integer K, complex ALPHA, complex, dimension(lda,*) A, integer LDA, complex, dimension(ldb,*) B, integer LDB, real BETA, complex, dimension(ldc,*) C, integer LDC)

CHER2K

Purpose:

` CHER2K  performs one of the hermitian rank 2k operations    C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C, or    C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C, where  alpha and beta  are scalars with  beta  real,  C is an  n by n hermitian matrix and  A and B  are  n by k matrices in the first case and  k by n  matrices in the second case.`

Parameters:

UPLO

`          UPLO is CHARACTER*1           On  entry,   UPLO  specifies  whether  the  upper  or  lower           triangular  part  of the  array  C  is to be  referenced  as           follows:              UPLO = 'U' or 'u'   Only the  upper triangular part of  C                                  is to be referenced.              UPLO = 'L' or 'l'   Only the  lower triangular part of  C                                  is to be referenced.`

TRANS

`          TRANS is CHARACTER*1           On entry,  TRANS  specifies the operation to be performed as           follows:              TRANS = 'N' or 'n'    C := alpha*A*B**H          +                                         conjg( alpha )*B*A**H +                                         beta*C.              TRANS = 'C' or 'c'    C := alpha*A**H*B          +                                         conjg( alpha )*B**H*A +                                         beta*C.`

N

`          N is INTEGER           On entry,  N specifies the order of the matrix C.  N must be           at least zero.`

K

`          K is INTEGER           On entry with  TRANS = 'N' or 'n',  K  specifies  the number           of  columns  of the  matrices  A and B,  and on  entry  with           TRANS = 'C' or 'c',  K  specifies  the number of rows of the           matrices  A and B.  K must be at least zero.`

ALPHA

`          ALPHA is COMPLEX           On entry, ALPHA specifies the scalar alpha.`

A

`          A is COMPLEX array of DIMENSION ( LDA, ka ), where ka is           k  when  TRANS = 'N' or 'n',  and is  n  otherwise.           Before entry with  TRANS = 'N' or 'n',  the  leading  n by k           part of the array  A  must contain the matrix  A,  otherwise           the leading  k by n  part of the array  A  must contain  the           matrix A.`

LDA

`          LDA is INTEGER           On entry, LDA specifies the first dimension of A as declared           in  the  calling  (sub)  program.   When  TRANS = 'N' or 'n'           then  LDA must be at least  max( 1, n ), otherwise  LDA must           be at least  max( 1, k ).`

B

`          B is COMPLEX array of DIMENSION ( LDB, kb ), where kb is           k  when  TRANS = 'N' or 'n',  and is  n  otherwise.           Before entry with  TRANS = 'N' or 'n',  the  leading  n by k           part of the array  B  must contain the matrix  B,  otherwise           the leading  k by n  part of the array  B  must contain  the           matrix B.`

LDB

`          LDB is INTEGER           On entry, LDB specifies the first dimension of B as declared           in  the  calling  (sub)  program.   When  TRANS = 'N' or 'n'           then  LDB must be at least  max( 1, n ), otherwise  LDB must           be at least  max( 1, k ).`

BETA

`          BETA is REAL           On entry, BETA specifies the scalar beta.`

C

`          C is COMPLEX array of DIMENSION ( LDC, n ).           Before entry  with  UPLO = 'U' or 'u',  the leading  n by n           upper triangular part of the array C must contain the upper           triangular part  of the  hermitian matrix  and the strictly           lower triangular part of C is not referenced.  On exit, the           upper triangular part of the array  C is overwritten by the           upper triangular part of the updated matrix.           Before entry  with  UPLO = 'L' or 'l',  the leading  n by n           lower triangular part of the array C must contain the lower           triangular part  of the  hermitian matrix  and the strictly           upper triangular part of C is not referenced.  On exit, the           lower triangular part of the array  C is overwritten by the           lower triangular part of the updated matrix.           Note that the imaginary parts of the diagonal elements need           not be set,  they are assumed to be zero,  and on exit they           are set to zero.`

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, n ).`

Author:

Univ. of Tennessee

Univ. of California Berkeley

NAG Ltd.

Date:

November 2011

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.  -- Modified 8-Nov-93 to set C(J,J) to REAL( C(J,J) ) when BETA = 1.     Ed Anderson, Cray Research Inc.`

Definition at line 199 of file cher2k.f.

`199 *200 *  -- Reference BLAS level3 routine (version 3.4.0) --201 *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --202 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--203 *     November 2011204 *205 *     .. Scalar Arguments ..206       COMPLEX alpha207       REAL beta208       INTEGER k,lda,ldb,ldc,n209       CHARACTER trans,uplo210 *     ..211 *     .. Array Arguments ..212       COMPLEX a(lda,*),b(ldb,*),c(ldc,*)213 *     ..214 *215 *  =====================================================================216 *217 *     .. External Functions ..218       LOGICAL lsame219       EXTERNAL lsame220 *     ..221 *     .. External Subroutines ..222       EXTERNAL xerbla223 *     ..224 *     .. Intrinsic Functions ..225       INTRINSIC conjg,max,real226 *     ..227 *     .. Local Scalars ..228       COMPLEX temp1,temp2229       INTEGER i,info,j,l,nrowa230       LOGICAL upper231 *     ..232 *     .. Parameters ..233       REAL one234       parameter(one=1.0e+0)235       COMPLEX zero236       parameter(zero= (0.0e+0,0.0e+0))237 *     ..238 *239 *     Test the input parameters.240 *241       IF (lsame(trans,'N')) THEN242           nrowa = n243       ELSE244           nrowa = k245       END IF246       upper = lsame(uplo,'U')247 *248       info = 0249       IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN250           info = 1251       ELSE IF ((.NOT.lsame(trans,'N')) .AND.252      +         (.NOT.lsame(trans,'C'))) THEN253           info = 2254       ELSE IF (n.LT.0) THEN255           info = 3256       ELSE IF (k.LT.0) THEN257           info = 4258       ELSE IF (lda.LT.max(1,nrowa)) THEN259           info = 7260       ELSE IF (ldb.LT.max(1,nrowa)) THEN261           info = 9262       ELSE IF (ldc.LT.max(1,n)) THEN263           info = 12264       END IF265       IF (info.NE.0) THEN266           CALL xerbla('CHER2K',info)267           RETURN268       END IF269 *270 *     Quick return if possible.271 *272       IF ((n.EQ.0) .OR. (((alpha.EQ.zero).OR.273      +    (k.EQ.0)).AND. (beta.EQ.one))) RETURN274 *275 *     And when  alpha.eq.zero.276 *277       IF (alpha.EQ.zero) THEN278           IF (upper) THEN279               IF (beta.EQ.REAL(zero)) then280                   DO 20 j = 1,n281                       DO 10 i = 1,j282                           c(i,j) = zero283    10                 CONTINUE284    20             CONTINUE285               ELSE286                   DO 40 j = 1,n287                       DO 30 i = 1,j - 1288                           c(i,j) = beta*c(i,j)289    30                 CONTINUE290                       c(j,j) = beta*REAL(c(j,j))291    40             CONTINUE292               END IF293           ELSE294               IF (beta.EQ.REAL(zero)) then295                   DO 60 j = 1,n296                       DO 50 i = j,n297                           c(i,j) = zero298    50                 CONTINUE299    60             CONTINUE300               ELSE301                   DO 80 j = 1,n302                       c(j,j) = beta*REAL(c(j,j))303                       DO 70 i = j + 1,n304                           c(i,j) = beta*c(i,j)305    70                 CONTINUE306    80             CONTINUE307               END IF308           END IF309           RETURN310       END IF311 *312 *     Start the operations.313 *314       IF (lsame(trans,'N')) THEN315 *316 *        Form  C := alpha*A*B**H + conjg( alpha )*B*A**H +317 *                   C.318 *319           IF (upper) THEN320               DO 130 j = 1,n321                   IF (beta.EQ.REAL(zero)) then322                       DO 90 i = 1,j323                           c(i,j) = zero324    90                 CONTINUE325                   ELSE IF (beta.NE.one) THEN326                       DO 100 i = 1,j - 1327                           c(i,j) = beta*c(i,j)328   100                 CONTINUE329                       c(j,j) = beta*REAL(c(j,j))330                   ELSE331                       c(j,j) = REAL(c(j,j))332                   END IF333                   DO 120 l = 1,k334                       IF ((a(j,l).NE.zero) .OR. (b(j,l).NE.zero)) THEN335                           temp1 = alpha*conjg(b(j,l))336                           temp2 = conjg(alpha*a(j,l))337                           DO 110 i = 1,j - 1338                               c(i,j) = c(i,j) + a(i,l)*temp1 +339      +                                 b(i,l)*temp2340   110                     CONTINUE341                           c(j,j) = REAL(C(J,J)) +342      +                             REAL(a(j,l)*temp1+b(j,l)*temp2)343                       END IF344   120             CONTINUE345   130         CONTINUE346           ELSE347               DO 180 j = 1,n348                   IF (beta.EQ.REAL(zero)) then349                       DO 140 i = j,n350                           c(i,j) = zero351   140                 CONTINUE352                   ELSE IF (beta.NE.one) THEN353                       DO 150 i = j + 1,n354                           c(i,j) = beta*c(i,j)355   150                 CONTINUE356                       c(j,j) = beta*REAL(c(j,j))357                   ELSE358                       c(j,j) = REAL(c(j,j))359                   END IF360                   DO 170 l = 1,k361                       IF ((a(j,l).NE.zero) .OR. (b(j,l).NE.zero)) THEN362                           temp1 = alpha*conjg(b(j,l))363                           temp2 = conjg(alpha*a(j,l))364                           DO 160 i = j + 1,n365                               c(i,j) = c(i,j) + a(i,l)*temp1 +366      +                                 b(i,l)*temp2367   160                     CONTINUE368                           c(j,j) = REAL(C(J,J)) +369      +                             REAL(a(j,l)*temp1+b(j,l)*temp2)370                       END IF371   170             CONTINUE372   180         CONTINUE373           END IF374       ELSE375 *376 *        Form  C := alpha*A**H*B + conjg( alpha )*B**H*A +377 *                   C.378 *379           IF (upper) THEN380               DO 210 j = 1,n381                   DO 200 i = 1,j382                       temp1 = zero383                       temp2 = zero384                       DO 190 l = 1,k385                           temp1 = temp1 + conjg(a(l,i))*b(l,j)386                           temp2 = temp2 + conjg(b(l,i))*a(l,j)387   190                 CONTINUE388                       IF (i.EQ.j) THEN389                           IF (beta.EQ.REAL(zero)) then390                               c(j,j) = REAL(alpha*temp1+391      +                                 conjg(alpha)*temp2)392                           ELSE393                               c(j,j) = beta*REAL(C(J,J)) +394      +                                 REAL(alpha*temp1+395      +                                 conjg(alpha)*temp2)396                           END IF397                       ELSE398                           IF (beta.EQ.REAL(zero)) then399                               c(i,j) = alpha*temp1 + conjg(alpha)*temp2400                           ELSE401                               c(i,j) = beta*c(i,j) + alpha*temp1 +402      +                                 conjg(alpha)*temp2403                           END IF404                       END IF405   200             CONTINUE406   210         CONTINUE407           ELSE408               DO 240 j = 1,n409                   DO 230 i = j,n410                       temp1 = zero411                       temp2 = zero412                       DO 220 l = 1,k413                           temp1 = temp1 + conjg(a(l,i))*b(l,j)414                           temp2 = temp2 + conjg(b(l,i))*a(l,j)415   220                 CONTINUE416                       IF (i.EQ.j) THEN417                           IF (beta.EQ.REAL(zero)) then418                               c(j,j) = REAL(alpha*temp1+419      +                                 conjg(alpha)*temp2)420                           ELSE421                               c(j,j) = beta*REAL(C(J,J)) +422      +                                 REAL(alpha*temp1+423      +                                 conjg(alpha)*temp2)424                           END IF425                       ELSE426                           IF (beta.EQ.REAL(zero)) then427                               c(i,j) = alpha*temp1 + conjg(alpha)*temp2428                           ELSE429                               c(i,j) = beta*c(i,j) + alpha*temp1 +430      +                                 conjg(alpha)*temp2431                           END IF432                       END IF433   230             CONTINUE434   240         CONTINUE435           END IF436       END IF437 *438       RETURN439 *440 *     End of CHER2K.441 *`

## Author

Generated automatically by Doxygen for LAPACK from the source code.

## Index

NAME
SYNOPSIS
Functions/Subroutines
Function/Subroutine Documentation
subroutine CHER2K (character UPLO, character TRANS, integer N, integer K, complex ALPHA, complex, dimension(lda,*) A, integer LDA, complex, dimension(ldb,*) B, integer LDB, real BETA, complex, dimension(ldc,*) C, integer LDC)
Author

This document was created byman2html,using the manual pages.  