Rate This Document
Findability
Accuracy
Completeness
Readability

?gemm3m

Compute the product of a complex number matrix and a matrix.

The value of op(X) may be . Both alpha and beta are multiplication coefficients; op(A) is an m*k matrix; op(B) is a k*n matrix, and C is an m*n matrix.

Interface Definition

C interface:

void cblas_cgemm3m(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT M, const BLASINT N, const BLASINT K, 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_zgemm3m(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT M, const BLASINT N, const BLASINT K, 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 CGEMM3M(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)

CALL ZGEMM3M(TRANSA, TRANSB, M, N, K, 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

TransA

Enumeration type CBLAS_TRANSPOSE

Indicates whether the matrix A is a conventional matrix, a transpose matrix, or a conjugate matrix.

  • If TransA = CblasNoTrans, .
  • If TransA = CblasTrans, .
  • If TransA = CblasConjTrans, .

Input

TransB

Enumeration type CBLAS_TRANSPOSE

Indicates whether the matrix B is a conventional matrix, a transpose matrix, or a conjugate matrix.

  • If TransB = CblasNoTrans, .
  • If TransB = CblasTrans, .
  • If TransB = CblasConjTrans, then .

Input

M

Integer

Number of rows of matrices op(A) and C

Input

N

Integer

Number of columns of matrices op(B) and C

Input

K

Integer

Number of columns of the matrix op(A) and the number of rows of the matrix op(B)

Input

alpha

  • For cgemm3m, alpha is of single-precision complex number type.
  • For zgemm3m, alpha is of double-precision complex number type.

Multiplication coefficient

Input

A

  • For cgemm3m, A is of single-precision complex number type.
  • For zgemm3m, A is of double-precision complex number type.

Matrix A

Input

lda

Integer

  • If the matrix is column store and TransA = CblasNoTrans, lda is at least max(1, m); otherwise, lda is at least max(1, k).
  • If A is a row-store matrix and TransA = CblasNoTrans, lda is at least max(1, m); otherwise, lda is at least max(1, k).

Input

B

  • For cgemm3m, B is of single-precision complex number type.
  • For zgemm3m, B is of double-precision complex number type.

Matrix B

Input

ldb

Integer

  • If the matrix is column store and TransA = CblasNoTrans, ldb is at least max(1, k); otherwise, ldb is at least max(1, n).
  • If A is a row-store matrix and TransA = CblasNoTrans, lda is at least max(1, n); otherwise, lda is at least max(1, k).

Input

beta

  • For cgemm3m, beta is of single-precision complex number type.
  • For zgemm3m, beta is of double-precision complex number type.

Multiplication coefficient

Input

C

  • For cgemm3m, C is of single-precision complex number type.
  • For zgemm3m, C is of double-precision complex number type.

Matrix C

Input/Output

ldc

Integer

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

Input

Dependencies

#include "kblas.h"

Examples

    int m = 4, k = 3, n = 4, lda = 4, ldb = 3, ldc = 4; 
    float alpha[2] = {1.0, 2.0}, beta[2] = {2.0, -1.0}; 
    /** 
     *    A: 
     *         0.340188, -0.105617,  -0.222225, 0.053970,  0.135712, 0.217297 
     *         0.283099, 0.298440,  -0.022603, 0.128871,  -0.358397, 0.106969 
     *         0.411647, -0.302449,  -0.135216, 0.013401,  -0.483699, -0.257113 
     *         -0.164777, 0.268230,  0.452230, 0.416195,  -0.362768, 0.304177 
     *    B: 
     *         -0.343321, -0.099056,  0.012932, 0.339112,  -0.006417, 0.472775,  -0.099771, 0.391529 
     *         -0.370210, -0.391191,  0.112640, -0.203968,  -0.207483, 0.271358,  -0.216685, -0.147542 
     *         0.498924, -0.281743,  0.137552, 0.024287,  0.026745, 0.269914,  0.307725, 0.419026 
     *    C: 
     *         -0.430245, 0.449327,  -0.435829, -0.479977,  -0.233334, 0.039760,  -0.062362, 0.431835 
     *         0.025995, -0.413944,  -0.042298, -0.436904,  -0.124793, 0.260249,  0.430810, 0.220952 
     *         -0.307786, 0.163227,  -0.261720, 0.470634,  0.012535, 0.167724,  -0.215707, 0.238534 
     *         0.390233, -0.151107,  0.402208, 0.350920,  0.031606, -0.460720,  0.139979, -0.145951 
     * 
     */ 
    float a[24] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647, -0.302449, -0.164777, 0.268230, 
                   -0.222225, 0.053970, -0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 0.416195, 
                   0.135712, 0.217297, -0.358397, 0.109, -0.483699, -0.257113, -0.362768, 0.304177}; 
    float b[24] = {-0.343321, -0.099056, -0.370210, -0.391191, 0.498924, -0.281743, 
                   0.012932, 0.339112, 0.112640, -0.203968, 0.137552, 0.024287, 
                   -0.006417, 0.472775, -0.207483, 0.271358, 0.026745, 0.269914, 
                   -0.099771, 0.529, -0.216685, -0.147542, 0.307725, 0.419026}; 
    float c[32] = {-0.430245, 0.449327, 0.025995, -0.413944, -0.307786, 0.163227, 0.390233, -0.151107, 
                   -0.435829, -0.479977, -0.042298, -0.436904, -0.261720, 0.470634, 0.402208, 0.350920, 
                   -0.233334, 0.039760, -0.124793, 0.260249, 0.012535, 0.167724, 0.031606, -0.460720, 
                   -0.062362, 0.431835, 0.430810, 0.220952, -0.215707, 0.238534, 0.139979, -0.145951}; 
 
    cblas_cgemm3m(CblasColMajor,CblasNoTrans,CblasNoTrans, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc); 
    /** 
     * Output C: 
     *         -0.585492, 1.678710,  -1.709228, -0.246373,  -0.667621, 0.493688,  -0.334783, 1.318867 
     *         -0.490883, -1.181802,  -0.897803, -0.957732,  -0.212003, 0.226129,  0.806885, -0.646487 
     *         -1.120088, -0.106275,  -0.253022, 1.390848,  0.374721, 0.785023,  -0.050149, 0.894140 
     *         0.918170, -0.878755,  1.270267, 0.205796,  -0.555751, -1.934741,  0.391359, -1.563382 
     */

Fortran interface:

      PROGRAM GEMM3M 
      INTEGER :: M=4, K=3, N=4 
      INTEGER :: LDA=4, LDB=3, LDC=4 
      COMPLEX(4) :: ALPHA=(1.0, 2.0), BETA=(2.0, -1.0) 
      COMPLEX(4) :: A(4, 3), B(3, 4), C(4, 4) 
      DATA A/(0.340188, -0.105617), (0.283099, 0.298440), 
     $       (0.411647, -0.302449), (-0.164777, 0.268230), 
     $       (-0.222225, 0.053970), (-0.022603, 0.128871), 
     $       (-0.135216, 0.013401), (0.452230, 0.416195), 
     $       (0.135712, 0.217297), (-0.358397, 0.109), 
     $       (-0.483699, -0.257113), (-0.362768, 0.304177)/ 
      DATA B/(-0.343321, -0.099056), (-0.370210, -0.391191), 
     $       (0.498924, -0.281743), (0.012932, 0.339112), 
     $       (0.112640, -0.203968), (0.137552, 0.024287), 
     $       (-0.006417, 0.472775), (-0.207483, 0.271358), 
     $       (0.026745, 0.269914), (-0.099771, 0.529), 
     $       (-0.216685, -0.147542), (0.307725, 0.419026)/ 
      DATA C/(-0.430245, 0.449327), (0.025995, -0.413944), 
     $       (-0.307786, 0.163227), (0.390233, -0.151107), 
     $       (-0.435829, -0.479977), (-0.042298, -0.436904), 
     $       (-0.261720, 0.470634), (0.402208, 0.350920), 
     $       (-0.233334, 0.039760), (-0.124793, 0.260249), 
     $        (0.012535, 0.167724), (0.031606, -0.460720), 
     $       (-0.062362, 0.431835), (0.430810, 0.220952), 
     $       (-0.215707, 0.238534), (0.139979, -0.145951)/ 
      EXTERNAL CGEMM3M 
      CALL CGEMM3M('N', 'N', M, N, K, ALPHA, A, LDA, B, LDB, 
     $             BETA, C, LDC) 
      END 
*     Output C: 
*             (-0.585492, 1.678710), (-1.709228, -0.246373),  (-0.667621, 0.493688),  (-0.334783, 1.318867) 
*             (-0.490883, -1.181802), (-0.897803, -0.957732),  (-0.212003, 0.226129),  (0.806885, -0.646487) 
*             (-1.120088, -0.106275), (-0.253022, 1.390848),  (0.374721, 0.785023),  (-0.050149, 0.894140) 
*             (0.918170, -0.878755),  (1.270267, 0.205796),  (-0.555751, -1.934741),  (0.391359, -1.563382)