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

mkl_?imatcopy_batch

Computes a group of in-place scaled matrix copy or transposition operations on general matrices.

Syntax

void mkl_simatcopy_batch (char layout, const char * trans_array, const size_t * rows_array, const size_t * cols_array, const float * alpha_array, float ** ab_array, const size_t * lda_array, const size_t * ldb_array, size_t group_count, const size_t * group_size);

void mkl_dimatcopy_batch (char layout, const char * trans_array, const size_t * rows_array, const size_t * cols_array, const double * alpha_array, double ** ab_array, const size_t * lda_array, const size_t * ldb_array, size_t group_count, const size_t * group_size);

void mkl_cimatcopy_batch (char layout, const char * trans_array, const size_t * rows_array, const size_t * cols_array, const MKL_Complex8 * alpha_array, MKL_Complex8 ** ab_array, const size_t * lda_array, const size_t * ldb_array, size_t group_count, const size_t * group_size);

void mkl_zimatcopy_batch (char layout, const char * trans_array, const size_t * rows_array, const size_t * cols_array, const MKL_Complex16 * alpha_array, MKL_Complex16 ** ab_array, const size_t * lda_array, const size_t * ldb_array, size_t group_count, const size_t * group_size);

Description

The mkl_?imatcopy_batch routine performs a series of in-place scaled matrix copies or transpositions. They are similar to the mkl_?imatcopy routine counterparts, but the mkl_?imatcopy_batch routine performs matrix operations with groups of matrices. Each group has the same parameters (matrix size, leading dimension, and scaling parameter), but a single call to mkl_?imatcopy_batch operates on multiple groups, and each group can have different parameters, unlike the related mkl_?imatcopy_batch_strided routines.

The operation is defined as

idx = 0
for i = 0..group_count - 1
     m in rows_array[i], n in cols_array[i], and alpha in alpha_array[i]
     for j = 0..group_size[i] - 1 
          AB matrices in AB_array[idx]
          AB := alpha*op(AB)
          idx = idx + 1
     end for
end for

Where op(X) is one of op(X)=X, op(X)=X', op(X)=conjg(X'), or op(X)=conjg(X). On entry, AB is a m-by-n matrix such that m and n are elements of rows_array and cols_array.

AB represents a matrix stored at addresses pointed to by AB_array. The number of entries in AB_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 (R) or column-major (C).

trans_array

Array of size group_count. For the group i, trans = trans_array[i] specifies the form of op(AB), the transposition operation applied to the AB matrix:

If trans = 'N' or 'n', op(AB)=AB.

If trans = 'T' or 't', op(AB)=AB'

If trans = 'C' or 'c', op(AB)=conjg(AB')

If trans = 'R' or 'r', op(AB)=conjg(AB)

rows_array

Array of size group_count. Specifies the number of rows of the input matrix AB. The value of each element must be at least zero.

cols_array

Array of size group_count. Specifies the number of columns of the input matrix AB. The value of each element must be at least zero.

alpha_array

Array of size group_count. Specifies the scalar alpha.

AB_array

Array of size total_batch_count, holding pointers to arrays used to store AB matrices.

lda_array

Array of size group_count. The leading dimension of the matrix input AB. It must be positive and at least m if column major layout is used or at least n if row major layout is used.

ldb_array

Array of size group_count. The leading dimension of the matrix input AB. It must be positive and at least

m if column major layout is used and op(AB) = AB or conjg(AB)

n if row major layout is used and op(AB) = AB' or conjg(AB')

n otherwise

group_count

Specifies the number of groups. Must be at least 0

group_size

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

Output Parameters

AB_array

Output array of size total_batch_count, holding pointers to arrays used to store the updated AB matrices.