aoclsparse_?doti() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
float aoclsparse_sdoti(const aoclsparse_int nnz, const float *x, const aoclsparse_int *indx, const float *y)#
double aoclsparse_ddoti(const aoclsparse_int nnz, const double *x, const aoclsparse_int *indx, const double *y)#

Sparse dot product for single and double data precision real types.

aoclsparse_sdoti() and aoclsparse_ddoti() compute the dot product of a real vector stored in a compressed format and a real dense vector. Let \(x\) and \(y\) be respectively a sparse and dense vectors in \(R^m\) with indx ( \(I_x\)) an indices array of length at least nnz that is used to index into the entries of dense vector \(y\), then these functions return

\[ {\bf\mathsf{dot}} = \sum_{i=0}^{{\bf\mathsf{nnz}}-1} x_{i} \cdot y_{I_{x_i}}. \]

Note

The contents of the vectors are not checked for NaNs.

Parameters:
  • nnz[in] The number of elements to access in vectors x and indx.

  • x[in] Array of at least nnz elements.

  • indx[in] Nonzero indices set, \(I_x\), of x described by this array of length at least nnz. Each entry must contain a valid index into y and be unique. The entries of indx are not checked for validity.

  • y[in] Array of at least \(\max(I_{x_i}, i \in \{ 1,\ldots,{\bf\mathsf{nnz}}\})\) elements.

Return values:

dot – Value of the dot product if nnz is positive, otherwise returns 0.