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_?csradd

Computes the sum of two matrices stored in the CSR format (3-array variation) with one-based indexing (deprecated).

Syntax

void mkl_dcsradd (const char *trans , const MKL_INT *request , const MKL_INT *sort , const MKL_INT *m , const MKL_INT *n , double *a , MKL_INT *ja , MKL_INT *ia , const double *beta , double *b , MKL_INT *jb , MKL_INT *ib , double *c , MKL_INT *jc , MKL_INT *ic , const MKL_INT *nzmax , MKL_INT *info );

void mkl_scsradd (const char *trans , const MKL_INT *request , const MKL_INT *sort , const MKL_INT *m , const MKL_INT *n , float *a , MKL_INT *ja , MKL_INT *ia , const float *beta , float *b , MKL_INT *jb , MKL_INT *ib , float *c , MKL_INT *jc , MKL_INT *ic , const MKL_INT *nzmax , MKL_INT *info );

void mkl_ccsradd (const char *trans , const MKL_INT *request , const MKL_INT *sort , const MKL_INT *m , const MKL_INT *n , MKL_Complex8 *a , MKL_INT *ja , MKL_INT *ia , const MKL_Complex8 *beta , MKL_Complex8 *b , MKL_INT *jb , MKL_INT *ib , MKL_Complex8 *c , MKL_INT *jc , MKL_INT *ic , const MKL_INT *nzmax , MKL_INT *info );

void mkl_zcsradd (const char *trans , const MKL_INT *request , const MKL_INT *sort , const MKL_INT *m , const MKL_INT *n , MKL_Complex16 *a , MKL_INT *ja , MKL_INT *ia , const MKL_Complex16 *beta , MKL_Complex16 *b , MKL_INT *jb , MKL_INT *ib , MKL_Complex16 *c , MKL_INT *jc , MKL_INT *ic , const MKL_INT *nzmax , MKL_INT *info );

Include Files

  • mkl.h

Description

This routine is deprecated. Use mkl_sparse_?_addfrom the Intel® oneAPI Math Kernel Library (oneMKL) Inspector-executor Sparse BLAS interface instead.

The mkl_?csradd routine performs a matrix-matrix operation defined as

C := A+beta*op(B)

where:

A, B, C are the sparse matrices in the CSR format (3-array variation).

op(B) is one of op(B) = B, or op(B) = BT, or op(B) = BH

beta is a scalar.

The routine works correctly if and only if the column indices in sparse matrix representations of matrices A and B are arranged in the increasing order for each row. If not, use the parameter sort (see below) to reorder column indices and the corresponding elements of the input matrices.

NOTE:

This routine supports only one-based indexing of the input arrays.

Input Parameters

trans

Specifies the operation.

If trans = 'N' or 'n', then C := A+beta*B

If trans = 'T' or 't', then C := A+beta*BT

If trans = 'C' or 'c', then C := A+beta*BH.

request

If request=0, the routine performs addition. The memory for the output arrays ic, jc, c must be allocated beforehand.

If request=1, the routine only computes the values of the array ic of length m + 1. The memory for the ic array must be allocated beforehand. On exit the value ic[m] - 1 is the actual number of the elements in the arrays c and jc.

If request=2, after the routine is called previously with the parameter request=1 and after the output arrays jc and c are allocated in the calling program with length at least ic[m] - 1, the routine performs addition.

sort

Specifies the type of reordering. If this parameter is not set (default), the routine does not perform reordering.

If sort=1, the routine arranges the column indices ja for each row in the increasing order and reorders the corresponding values of the matrix A in the array a.

If sort=2, the routine arranges the column indices jb for each row in the increasing order and reorders the corresponding values of the matrix B in the array b.

If sort=3, the routine performs reordering for both input matrices A and B.

m

Number of rows of the matrix A.

n

Number of columns of the matrix A.

a

Array containing non-zero elements of the matrix A. Its length is equal to the number of non-zero elements in the matrix A. Refer to values array description in Sparse Matrix Storage Formats for more details.

ja

Array containing the column indices plus one for each non-zero element of the matrix A. For each row the column indices must be arranged in the increasing order.

The length of this array is equal to the length of the array a. Refer to columns array description in Sparse Matrix Storage Formats for more details.

ia

Array of length m + 1, containing indices of elements in the array a, such that ia[i] - ia[0] is the index in the array a of the first non-zero element from the row i. The value of the last element ia[m] is equal to the number of non-zero elements of the matrix A plus one. Refer to rowIndex array description in Sparse Matrix Storage Formats for more details.

beta

Specifies the scalar beta.

b

Array containing non-zero elements of the matrix B. Its length is equal to the number of non-zero elements in the matrix B. Refer to values array description in Sparse Matrix Storage Formats for more details.

jb

Array containing the column indices plus one for each non-zero element of the matrix B. For each row the column indices must be arranged in the increasing order.

The length of this array is equal to the length of the array b. Refer to columns array description in Sparse Matrix Storage Formats for more details.

ib

Array of length m + 1 when trans = 'N' or 'n', or n + 1 otherwise.

This array contains indices of elements in the array b, such that ib[i] - ib[0] is the index in the array b of the first non-zero element from the row i. The value of the last element ib[m] or ib[n] is equal to the number of non-zero elements of the matrix B plus one. Refer to rowIndex array description in Sparse Matrix Storage Formats for more details.

nzmax

The length of the arrays c and jc.

This parameter is used only if request=0. The routine stops calculation if the number of elements in the result matrix C exceeds the specified value of nzmax.

Output Parameters

c

Array containing non-zero elements of the result matrix C. Its length is equal to the number of non-zero elements in the matrix C. Refer to values array description in Sparse Matrix Storage Formats for more details.

jc

Array containing the column indices plus one for each non-zero element of the matrix C.

The length of this array is equal to the length of the array c. Refer to columns array description in Sparse Matrix Storage Formats for more details.

ic

Array of length m + 1, containing indices of elements in the array c, such that ic[i] - ic[0] is the index in the array c of the first non-zero element from the row i. The value of the last element ic[m] is equal to the number of non-zero elements of the matrix C plus one. Refer to rowIndex array description in Sparse Matrix Storage Formats for more details.

info

If info=0, the execution is successful.

If info=I>0, the routine stops calculation in the I-th row of the matrix C because number of elements in C exceeds nzmax.

If info=-1, the routine calculates only the size of the arrays c and jc and returns this value plus 1 as the last element of the array ic.