Previous Next Contents Generated Index Doc Set Home



Product of a Hermitian Matrix and a General Matrix

The subroutines described in this section compute one of the following results for the Hermitian matrix A, the general matrices B and C, and the scalars and :

Operation
SIDE
Matrix A
Matrix B

'L' or 'l'

m x m

m x n

'R' or 'r

n x n

m x n

Calling Sequence

CALL ZHEMM 
(SIDE, UPLO, M, N, ZALPHA, ZA, LDA, ZB, LDB, ZBETA, ZC, 
LDC)
CALL CHEMM 
(SIDE, UPLO, M, N, CALPHA, CA, LDA, CB, LDB, CBETA, CC, 
LDC)






void zhemm 
(char side, char uplo, int m, int n, doublecomplex 
*zalpha, doublecomplex *za, int lda, doublecomplex * 
b, int ldb, doublecomplex *zbeta, doublecomplex *zc, 
int ldc)
void chemm 
(char side, char uplo, int m, int n, complex *calpha, 
complex *ca, int lda, complex *cb, int ldb, complex 
*cbeta, complex *cc, int ldc)

Arguments

SIDE

Indicates whether the product involving matrices A and B should be formed as AB or BA. The legal values for SIDE are listed below. Any value not listed below is illegal.

'L' or 'l'

Compute AB.

'R' or 'r'

Compute BA.

UPLO

Indicates whether the values in a matrix reside in the upper or lower triangle of the array in which it is stored. The legal values for UPLO are listed below. Any value not listed below is illegal.

'L' or 'l'

Only lower triangle of array will be referenced.

'U' or 'u'

Only upper triangle of array will be referenced.

M, N

Indicate the size of the matrices as shown in the table above.

xALPHA

Scalar that scales the input value of the matrix stored in A.

xA

Two-dimensional array in which one of the input matrices is stored.

LDA

Leading dimension of the array A as specified in the dimension or type statement. LDA max (1,N).

If SIDE = 'L' or 'l', LDA max (1,M).

xB

Two-dimensional array in which one of the input matrices is stored.

LDB

Leading dimension of the array B as specified in the dimension or type statement. LDB max (1,M).

xBETA

Scalar that scales the input value of the matrix stored in C.

xC

Two-dimensional array.

On entry, an input matrix.

On exit, the result matrix.

LDC

Leading dimension of the array C as specified in the dimension or type statement. LDC max (1,M).

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      REAL       RZERO
      INTEGER    LDA, LDB, LDC, M, N
      PARAMETER (M = 3)
      PARAMETER (N = 2)
      PARAMETER (LDA = M)
      PARAMETER (LDB = M)
      PARAMETER (LDC = M)
      PARAMETER (RZERO = 0.0E0)
C
      COMPLEX    A(LDA,M), ALPHA, B(LDB,N), BETA, C(LDC,N)
      INTEGER    I, J
C
      EXTERNAL   CHEMM
      INTRINSIC  CMPLX, CONJG, REAL
C
C     Initialize the array A to store in Hermitian form the matrix
C     A shown below.  Initialize the arrays B and C to store the
C     matrices B and C shown below.
C
C       1+0i  2-3i  4-5i       0-1i  0-2i       100+100i  100+100i
C   A = 2+3i  6+0i  7-8i   B = 0-1i  0-2i   C = 100+100i  100+100i
C       4+5i  7+8i  9+0i       0-1i  0-2i       100+100i  100+100i
C
      DATA A / (1.0,8E8), (2.0,3.0), (4.0,5.0),
     $         (8E8,8E8), (6.0,8E8), (7.0,8.0),
     $         (8E8,8E8), (8E8,8E8), (9.0,8E8) /
      DATA B / 3*(0.0D0,-1.0D0), 3*(0.0D0, -2.0D0) /
      DATA C / 6*(1.0E2,1.0E2) /
C
      ALPHA = CMPLX (1.0E0,0.0E0)
      BETA = CMPLX (5.0E0,0.0E0)
      PRINT 1000
      PRINT 1010, REAL (A(1,1)), RZERO, CONJG (A(2,1)), 
     $   CONJG (A(3,1))
      PRINT 1010, A(2,1), REAL (A(2,2)), RZERO, CONJG (A(3,2))
      PRINT 1010, A(3,1), A(3,2), REAL (A(3,3)), RZERO
      PRINT 1020
      PRINT 1010, ((A(I,J), J = 1, M), I = 1, M)
      PRINT 1030
      PRINT 1040, ((B(I,J), J = 1, N), I = 1, M)
      PRINT 1050
      PRINT 1040, ((C(I,J), J = 1, N), I = 1, M)
      CALL CHEMM ('LEFT SIDE A', 'LOWER TRIANGULAR A', M, N,
     $            ALPHA, A, LDA, B, LDB, BETA, C, LDC)
      PRINT 1060
      PRINT 1040, ((C(I,J), J = 1, N), I = 1, M)
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (3(3X, '(', F5.1, ',', F5.1, ')'))
 1020 FORMAT (/1X, 'A in Hermitian form:  (* in unused elements)')
 1030 FORMAT (/1X, 'B:')
 1040 FORMAT (2(3X, '(', F5.1, ',', F5.1, ')'))
 1050 FORMAT (/1X, 'C:')
 1060 FORMAT (/1X, 'AB + C:')
C
      END
 

Sample Output

 
 A in full form:
   (  1.0,  0.0)   (  2.0, -3.0)   (  4.0, -5.0)
   (  2.0,  3.0)   (  6.0,  0.0)   (  7.0, -8.0)
   (  4.0,  5.0)   (  7.0,  8.0)   (  9.0,  0.0)



 A in Hermitian form:  (* in unused elements)
   (  1.0,*****)   (*****,*****)   (*****,*****)
   (  2.0,  3.0)   (  6.0,*****)   (*****,*****)
   (  4.0,  5.0)   (  7.0,  8.0)   (  9.0,*****)



 B:
   (  0.0, -1.0)   (  0.0, -2.0)
   (  0.0, -1.0)   (  0.0, -2.0)
   (  0.0, -1.0)   (  0.0, -2.0)



 C:
   (100.0,100.0)   (100.0,100.0)
   (100.0,100.0)   (100.0,100.0)
   (100.0,100.0)   (100.0,100.0)



 AB + C:
   (492.0,493.0)   (484.0,486.0)
   (495.0,485.0)   (490.0,470.0)
   (513.0,480.0)   (526.0,460.0)






Previous Next Contents Generated Index Doc Set Home