我要评分
获取效率
正确性
完整性
易理解

?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 to use the upper triangle or lower triangle of matrix A.

  • If Uplo = CblasUpper, the upper triangle of A is used.
  • If Uplo = CblasLower, the lower triangle of A is used.

Input

M

Integer

Row of matrix C.

  • Row of the matrix A for A*B.
  • Row of the matrix B for B*A.

Input

N

Integer

Column of matrix C.

  • A*B is a column of the matrix B.
  • B*A is a column of the matrix A.

Input

alpha

  • For chemm, alpha is of single-precision complex number type.
  • For zhemm, alpha is of double-precision complex number type.

Multiplication coefficient

Input

A

  • For chemm, A is of single-precision complex number type.
  • For zhemm, A is of double-precision complex number type.

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

  • For chemm, B is of single-precision complex number type.
  • For zhemm, B is of double-precision complex number type.

Matrix B (ldb, n)

Input

ldb

Integer

  • If the matrix is column store, ldb must be at least max(1, m).
  • If the matrix is row store, ldb must be at least max(1, n).

Input

beta

  • For chemm, beta is of single-precision complex number type.
  • For zhemm, beta is of double-precision complex number type.

Multiplication coefficient

Input

C

  • For chemm, C is of single-precision complex number type.
  • For zhemm, C is of double-precision complex number type.

Matrix C (ldc, n)

Input/Output

ldc

Integer

  • If the matrix is column store, ldc must be at least max(1, m).
  • If the matrix is row store, ldc must be at least max(1, n).

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    =  |        .                .                .        | 
*                    |        .                .                .        | 
*                    |        .                .                .        |