C interface for Dot Product. More...

afError af_dot_S (float *h_res, unsigned len, const float *d_A, const float *d_B)
 
afError af_dot_D (double *h_res, unsigned len, const double *d_A, const double *d_B)
 
afError af_dot_C (cfloat *h_res, unsigned len, const cfloat *d_A, const cfloat *d_B)
 
afError af_dot_Z (cdouble *h_res, unsigned len, const cdouble *d_A, const cdouble *d_B)
 

Detailed Description

C interface for Dot Product.

Scalar dot product between two vectors. Also referred to as the inner product.

This function returns the scalar product of two equal sized vectors or between a matrix and a vector. The second operand needs to be a vector in either case.

  
// compute scalar dot product of two vectors
float a[] = {1, 2, 3};
float b[] = {2, 3, 4};
array A(3,a);
array B(3,b);
print(A);
print(B);
print(dot(A,B));
  

The dot product between a matrix and a vector is defined in a similar fashion:

  
float a_buff[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1};
float b_buff[] = {0, 1, 2, 3};

array A(4, 3, a_buff);
array B(4, b_buff);
print(A);
print(B);
print(dot(A, B));
  
matrix_vector_dot_product.png

Function Documentation

afError af_dot_S ( float *  h_res,
unsigned  len,
const float *  d_A,
const float *  d_B 
)
Parameters
[out]h_resThe output. (Host pointer);
[in]lenThe length of the vectors
[in]d_ADevice pointer to the first vector
[in]d_BDevice pointer to the second vector
afError af_dot_D ( double *  h_res,
unsigned  len,
const double *  d_A,
const double *  d_B 
)
afError af_dot_C ( cfloat h_res,
unsigned  len,
const cfloat d_A,
const cfloat d_B 
)
afError af_dot_Z ( cdouble h_res,
unsigned  len,
const cdouble d_A,
const cdouble d_B 
)