Previous Next Contents Generated Index Doc Set Home



Product of a Symmetric Matrix and a General Matrix

The subroutines described in this section compute one of the following results for the symmetric 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 DSYMM 
(SIDE, UPLO, M, N, DALPHA, DA, LDA, DB, LDB, DBETA, DC, 
LDC)
CALL SSYMM 
(SIDE, UPLO, M, N, SALPHA, SA, LDA, SB, LDB, SBETA, SC, 
LDC)
CALL ZSYMM 
(SIDE, UPLO, M, N, ZALPHA, ZA, LDA, ZB, LDB, ZBETA, ZC, 
LDC)
CALL CSYMM 
(SIDE, UPLO, M, N, CALPHA, CA, LDA, CB, LDB, CBETA, CC, 
LDC)






void dsymm 
(char side, char uplo, int m, int n, double dalpha, 
double *da, int lda, double *db, int ldb, double dbeta, 
double *dc, int ldc)
void ssymm 
(char side, char uplo, int m, int n, float salpha, 
float *sa, int lda, float *sb, int ldb, float sbeta, 
float *sc, int ldc)
void zsymm 
(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 csymm 
(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
      INTEGER           LDA, LDB, LDC, M, N
      PARAMETER        (M = 3)
      PARAMETER        (N = 2)
      PARAMETER        (LDA = M)
      PARAMETER        (LDB = M)
      PARAMETER        (LDC = M)
C
      DOUBLE PRECISION  A(LDA,M), ALPHA, B(LDB,N), BETA, C(LDC,N)
      INTEGER           I, J
C
      EXTERNAL          DSYMM
C
C     Initialize the array A to store in symmetric form the
C     symmetric matrix A shown below.  Initialize the arrays
C     B and C to store the matrices B and C shown below.
C
C          1  2  3        0  1        100  100
C     A =  2  4  5   B =  1  0   C =  100  100
C          3  5  6        2  2        100  100
C
      DATA A / 1.0D0, 2.0D0, 3.0D0, 8D8, 4.0D0, 5.0D0, 8D8, 8D8,
     $         6.0D0 /
      DATA B / 0.0D0, 1.0D0, 2.0D0, 1.0D0, 0.0D0, 2.0D0 /
      DATA C / 6*1.0D2 /
C
      ALPHA = 1.0D0
      BETA = 1.0D0
      PRINT 1000
      DO 100, I = 1, M
        PRINT 1010, (A(I,J), J = 1, I), (A(J,I), J = I + 1, M)
  100 CONTINUE
      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 DSYMM ('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))
 1020 FORMAT (/1X, 'A in symmetric form:  (* in unused elements)')
 1030 FORMAT (/1X, 'B:')
 1040 FORMAT (2(3X, F5.1))
 1050 FORMAT (/1X, 'C:')
 1060 FORMAT (/1X, 'AB + C:')
C
      END
 

Sample Output

 
 A in full form:
     1.0     2.0     3.0
     2.0     4.0     5.0
     3.0     5.0     6.0



 A in symmetric form:  (* in unused elements)
     1.0   *****   *****
     2.0     4.0   *****
     3.0     5.0     6.0



 B:
     0.0     1.0
     1.0     0.0
     2.0     2.0



 C:
   100.0   100.0
   100.0   100.0
   100.0   100.0



 AB + C:
   108.0   107.0
   114.0   112.0
   117.0   115.0






Previous Next Contents Generated Index Doc Set Home