Developer Reference for Intel® oneAPI Math Kernel Library for C

ID 766684
Date 11/07/2023
Public

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

Document Table of Contents

cblas_?gemv_batch

Computes groups of matrix-vector product with general matrices.

Syntax

void cblas_sgemv_batch (const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE *trans_array, const MKL_INT *m_array, const MKL_INT *n_array, const float *alpha_array, const float **a_array, const MKL_INT *lda_array, const float **x_array, const MKL_INT *incx_array, const float *beta_array, float **y_array, const MKL_INT *incy_array, const MKL_INT group_count, const MKL_INT *group_size);

void cblas_dgemv_batch (const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE *trans_array, const MKL_INT *m_array, const MKL_INT *n_array, const double *alpha_array, const double **a_array, const MKL_INT *lda_array, const double **x_array, const MKL_INT *incx_array, const double *beta_array, double **y_array, const MKL_INT *incy_array, const MKL_INT group_count, const MKL_INT *group_size);

void cblas_cgemv_batch (const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE *trans_array, const MKL_INT *m_array, const MKL_INT *n_array, const void *alpha_array, const void **a_array, const MKL_INT *lda_array, const void **x_array, const MKL_INT *incx_array, const void *beta_array, void **y_array, const MKL_INT *incy_array, const MKL_INT group_count, const MKL_INT *group_size);

void cblas_zgemv_batch (const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE *trans_array, const MKL_INT *m_array, const MKL_INT *n_array, const void *alpha_array, const void **a_array, const MKL_INT *lda_array, const void **x_array, const MKL_INT *incx_array, const void *beta_array, void **y_array, const MKL_INT *incy_array, const MKL_INT group_count, const MKL_INT *group_size);

Include Files

  • mkl.h

Description

The cblas_?gemv_batch routines perform a series of matrix-vector product added to a scaled vector. They are similar to the cblas_?gemv routine counterparts, but the cblas_?gemv_batch routines perform matrix-vector operations with groups 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
    trans, m, n, alpha, lda, incx, beta, incy and group_size at position i in trans_array, m_array, n_array, alpha_array, lda_array, incx_array, beta_array, incy_array and group_size_array
    for j = 0 … group_size – 1
        a is a matrix of size mxn at position idx in a_array
        x and y are vectors of size m or n depending on trans, at position idx in x_array and y_array
        y := alpha * op(a) * x + beta * y
        idx := idx + 1
    end for
end for

The number of entries in a_array, x_array, and y_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).

trans_array

Array of size group_count. For the group i, transi = trans_array[i] specifies the transposition operation applied to A.

if trans = CblasNoTrans, then op(A) = A;

if trans = CblasTrans, then op(A) = A';

if trans = CblasConjTrans, then op(A) = conjg(A').

m_array

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

n_array

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

alpha_array

Array of size group_count. For the group i, alphai = alpha_array[i] is the scalar alpha.

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 * ni if 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 A matrix is not transposed or mi otherwise.

incx_array

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

beta_array

Array of size group_count. For the group i, betai = beta_array[i] is the scalar beta.

y_array

Array of size total_batch_count of pointers used to store y vectors. The array allocated for the y vectors of the group i must be of size at least (1 + leni – 1)*abs(incyi)) where leni is mi if the A matrix is not transposed or ni otherwise.

incy_array

Array of size group_count. For the group i, incyi = incy_array[i] is the stride of vector y. Must not be zero.

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_count must be at least 0.

Output Parameters

y_array
Array of pointers holding the total_batch_count updated vector y.