Documentation

Calculate the dot product of a vector. More...

## Modules

dot
calculate the dot product of a vector

af_dot/cublas_dot
C interface for Dot Product.

## Detailed Description

Calculate the dot product of a vector.

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));