?hemm
Compute the product of matrices in which matrix A is a Hermitian matrix.
or
.
alpha and beta are multiplication coefficients, A is a Hermitian matrix, and B and C are m x n general matrices.
Interface Definition
C interface:
void cblas_chemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const BLASINT M, const BLASINT N, const void *alpha, const void *A, const BLASINT lda, const void *B, const BLASINT ldb, const void *beta, void *C, const BLASINT ldc);
void cblas_zhemm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const BLASINT M, const BLASINT N, const void *alpha, const void *A, const BLASINT lda, const void *B, const BLASINT ldb, const void *beta, void *C, const BLASINT ldc);
Fortran interface:
CALL CHEMM(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CALL ZHEMM(SIDE, UPLO, M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
order |
Enumeration type CBLAS_ORDER |
Indicates whether the matrix is in row- or column-major order. |
Input |
Side |
Enumeration type CBLAS_SIDE |
Indicates whether Hermitian matrix A is on the left or right side of matrix B. |
Input |
Uplo |
Enumeration type CBLAS_UPLO |
Indicates whether the upper triangle or the lower triangle of the matrix A is used.
|
Input |
M |
Integer |
Number of rows of matrix C.
|
Input |
N |
Integer |
Column of matrix C.
|
Input |
alpha |
|
Multiplication coefficient |
Input |
A |
|
Hermitian matrix A (lda, ka). If Side = CblasLeft, ka = m; otherwise, ka = n. |
Input |
lda |
Integer |
If Side = CblasLeft, lda is at least max(1, m); otherwise, lda is at least max(1, n). |
Input |
B |
|
Matrix B (ldb, n) |
Input |
ldb |
Integer |
|
Input |
beta |
|
Multiplication coefficient |
Input |
C |
|
Matrix C (ldc, n) |
Input/Output |
ldc |
Integer |
|
Input |
Dependencies
#include "kblas.h"
Examples
C interface:
int m = 2, n = 3, lda = 4, ldb =3, ldc = 5;
float alpha[2] = {2.0, 3.0}, beta[2] = {1.0, 6.0};
/**
*
* | (2.0, . ) . . |
* A = | (13.0, -2.0) (2.0, . ) . |
* | (-2.0, -6.0) (2.0, 14.0) (2.0, . ) |
* | . . . |
*
* | (2.0, 2.0) (-13.0, 12.0) (3.0, 3.0) |
* B = | (2.0, 6.0) (4.0, -5.0) (-11.0, -4.0) |
* | . . . |
*
* | (3.0, 6.0) (-1.0, 6.0) (1.0, 7.0) |
* | (-11.0, 8.0) (1.0, 1.0) (-14.0, 2.0) |
* C = | . . . |
* | . . . |
* | . . . |
*
*/
float a[24] = {2.0, 0, 13.0, -2.0, -2.0, -6.0, 0, 0,
0, 0, 2.0, 0, 2.0, 14.0, 0, 0,
0, 0, 0, 0,2.0, 0, 0, 0};
float b[18] = {2.0, 2.0, 2.0, 6.0, 0, 0,
-13.0, 12.0, 4.0, -5.0, 0, 0,
3.0, 3.0, -11.0, -4.0, 0, 0};
float c[30] = {3.0,6.0,-11.0,8.0,0,0,0,0,0,0,
-1.0,6.0,1.0,1.0,0,0,0,0,0,0,
1.0,7.0,-14.0,2.0,0,0,0,0,0,0};
cblas_chemm(CblasColMajor,CblasRight,CblasLower, m, n, alpha, a, lda, b, ldb, beta, c, ldc);
/**
* Ouput C
* | (-777.0, -39.0) (-423.0, 84.0) (-437.0, 849.0) |
* | (-10.0, 100.0) (337.0, -5.0) (-52.0, -602.0) |
* C = | . . . |
* | . . . |
* | . . . |
*
*/
Fortran interface:
INTEGER :: M=2, N=3
INTEGER :: LDA=4, LDB=3, LDC=5
COMPLEX(4) :: ALPHA=(2.0, 3.0), BETA=(1.0, 6.0)
COMPLEX(4) :: A(4, 3), B(3, 3), C(5, 3)
DATA A/(2.0, 0), (13.0, -2.0), (-2.0, -6.0), (0, 0),
$ (0, 0), (2.0, 0), (2.0, 14.0), (0, 0),
$ (0, 0), (0, 0), (2.0, 0), (0, 0)/
DATA B/(2.0, 2.0), (2.0, 6.0), (0, 0),
$ (-13.0, 12.0), (4.0, -5.0), (0, 0),
$ (3.0, 3.0), (-11.0, -4.0), (0, 0)/
DATA C/(3.0, 6.0), (-11.0, 8.0), (0, 0), (0, 0), (0, 0),
$ (-1.0, 6.0), (1.0, 1.0), (0, 0), (0, 0), (0, 0),
$ (1.0, 7.0), (-14.0, 2.0), (0, 0), (0, 0), (0, 0)/
EXTERNAL CHEMM
CALL CHEMM('R', 'L', M, N, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
* Ouput C
* | (-777.0, -39.0) (-423.0, 84.0) (-437.0, 849.0) |
* | (-10.0, 100.0) (337.0, -5.0) (-52.0, -602.0) |
* C = | . . . |
* | . . . |
* | . . . |