Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

cblas_?dgmm_batch

Computes groups of matrix-vector product using general matrices.

Syntax

void cblas_sdgmm_batch (const CBLAS_LAYOUT layout, const CBLAS_SIDE *left_right_array, const MKL_INT *m_array, const MKL_INT *n_array, const float **a_array, const MKL_INT *lda_array, const float **x_array, const MKL_INT *incx_array, float **c_array, const MKL_INT *ldc_array, const MKL_INT group_count, const MKL_INT *group_size);

void cblas_ddgmm_batch (const CBLAS_LAYOUT layout, const CBLAS_SIDE *left_right_array, const MKL_INT *m_array, const MKL_INT *n_array, const double **a_array, const MKL_INT *lda_array, const double **x_array, const MKL_INT *incx_array, double **c_array, const MKL_INT *ldc_array, const MKL_INT group_count, const MKL_INT *group_size);

void cblas_cdgmm_batch (const CBLAS_LAYOUT layout, const CBLAS_SIDE *left_right_array, const MKL_INT *m_array, const MKL_INT *n_array, const void **a_array, const MKL_INT *lda_array, const void **x_array, const MKL_INT *incx_array, void **c_array, const MKL_INT *ldc_array, const MKL_INT group_count, const MKL_INT *group_size);

void cblas_zdgmm_batch (const CBLAS_LAYOUT layout, const CBLAS_SIDE *left_right_array, const MKL_INT *m_array, const MKL_INT *n_array, const void **a_array, const MKL_INT *lda_array, const void **x_array, const MKL_INT *incx_array, void **c_array, const MKL_INT *ldc_array, const MKL_INT group_count, const MKL_INT *group_size);

Include Files

  • mkl.h

Description

The cblas_?dgmm_batch routines perform a series of diagonal matrix-matrix product. The diagonal matrices are stored as dense vectors and the operations are performed with group of matrices and vectors. .

Each group contains matrices and vectors with the same parameters (size, increments). The operation is defined as:

idx = 0
For i = 0 … group_count – 1
    left_right, m, n, lda, incx, ldc and group_size at position i in left_right_array, m_array, n_array, lda_array, incx_array, ldc_array and group_size_array
    for j = 0 … group_size – 1
        a and c are matrices of size mxn at position idx in a_array and c_array
        x is a vector of size m or n depending on left_right, at position idx in x_array
        if (left_right == oneapi::mkl::side::left) c := diag(x) * a
        else c := a * diag(x)
        idx := idx + 1
    end for
end for

The number of entries in a_array, x_array, and c_array is total_batch_count = the sum of all of the group_size entries.

Input Parameters

layout

Specifies whether two-dimensional array storage is row-major (CblasRowMajor) or column-major (CblasColMajor).

left_right_array

Array of size group_count. For the group i, left_righti = left_right_array[i] specifies the position of the diagonal matrix in the matrix product.

if left_righti = CblasLeft, then C = diag(X) * A.

if left_righti = CblasRight, then C = A * diag(X).

m_array

Array of size group_count. For the group i, mi = m_array[i] is the number of rows of the matrix A and C.

n_array

Array of size group_count. For the group i, ni = n_array[i] is the number of columns in the matrix A and C.

a_array

Array of size total_batch_count of pointers used to store A matrices. The array allocated for the A matrices of the group i must be of size at least ldai * niif column major layout is used or at least ldai * mi is row major layout is used.

lda_array

Array of size group_count. For the group i, ldai = lda_array[i] is the leading dimension of the matrix A. It must be positive and at least miif column major layout is used or at least ni if row major layout is used..

x_array

Array of size total_batch_count of pointers used to store x vectors. The array allocated for the x vectors of the group i must be of size at least (1 + leni – 1)*abs(incxi)) where leni is ni if the diagonal matrix is on the right of the product or mi otherwise.

incx_array

Array of size group_count. For the group i, incxi = incx_array[i] is the stride of vector x.

c_array

Array of size total_batch_count of pointers used to store C matrices. The array allocated for the C matrices of the group i must be of size at least ldci * ni, if column major layout is used or at least ldci * mi if row major layout is used.

ldc_array

Array of size group_count. For the group i, ldci = ldc_array[i] is the leading dimension of the matrix C. It must be positive and at least miif column major layout is used or at least ni if row major layout is used..

group_count

Number of groups. Must be at least 0.

group_size

Array of size group_count. The element group_count[i] is the number of operations in the group i. Each element in group_size must be at least 0.

Output Parameters

c_array
Array of pointers holding the total_batch_count updated matrix C.