A high-performance general-purpose compute library

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

Functions

template<typename T >
dot (const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
 Dot Product.
 
AFAPI array dot (const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
 
AFAPI af_err af_dot (af_array *out, const af_array lhs, const af_array rhs, const af_mat_prop optLhs, const af_mat_prop optRhs)
 Scalar dot product between two vectors.
 
AFAPI af_err af_dot_all (double *real, double *imag, const af_array lhs, const af_array rhs, const af_mat_prop optLhs, const af_mat_prop optRhs)
 Scalar dot product between two vectors.
 

Detailed Description

Calculate the dot product of a vector.

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


Function Documentation

◆ af_dot()

AFAPI af_err af_dot ( af_array out,
const af_array  lhs,
const af_array  rhs,
const af_mat_prop  optLhs,
const af_mat_prop  optRhs 
)

Scalar dot product between two vectors.

Also referred to as the inner product.

// compute scalar dot product
array x = randu(100), y = randu(100);
print(dot<float>(x,y));
Parameters
[out]outThe array object with the result of the dot operation
[in]lhsThe array object on the left hand side
[in]rhsThe array object on the right hand side
[in]optLhsOptions for lhs. Currently only AF_MAT_NONE and AF_MAT_CONJ are supported.
[in]optRhsOptions for rhs. Currently only AF_MAT_NONE and AF_MAT_CONJ are supported
Returns
AF_SUCCESS if the process is successful.

◆ af_dot_all()

AFAPI af_err af_dot_all ( double *  real,
double *  imag,
const af_array  lhs,
const af_array  rhs,
const af_mat_prop  optLhs,
const af_mat_prop  optRhs 
)

Scalar dot product between two vectors.

Also referred to as the inner product. Returns the result as a host scalar.

Parameters
[out]realis the real component of the result of dot operation
[out]imagis the imaginary component of the result of dot operation
[in]lhsThe array object on the left hand side
[in]rhsThe array object on the right hand side
[in]optLhsOptions for lhs. Currently only AF_MAT_NONE and AF_MAT_CONJ are supported.
[in]optRhsOptions for rhs. Currently only AF_MAT_NONE and AF_MAT_CONJ are supported
Returns
AF_SUCCESS if the process is successful.

◆ dot() [1/2]

T dot ( const array lhs,
const array rhs,
const matProp  optLhs = AF_MAT_NONE,
const matProp  optRhs = AF_MAT_NONE 
)

Dot Product.

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

// compute scalar dot product
array x = randu(100),
y = randu(100);
af_print(dot(x, y));
// OR
printf("%f\n", dot<float>(x, y));
A multi dimensional data container.
Definition: array.h:37
T dot(const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
Dot Product.
#define af_print(...)
Definition: util.h:148
Template Parameters
TThe type of the output
Parameters
[in]lhsThe array object on the left hand side
[in]rhsThe array object on the right hand side
[in]optLhsOptions for lhs. Currently only AF_MAT_NONE and AF_MAT_CONJ are supported.
[in]optRhsOptions for rhs. Currently only AF_MAT_NONE and AF_MAT_CONJ are supported
Returns
The result of the dot product of lhs, rhs
Note
optLhs and optRhs can only be one of AF_MAT_NONE or AF_MAT_CONJ
optLhs = AF_MAT_CONJ and optRhs = AF_MAT_NONE will run conjugate dot operation.
This function is not supported in GFOR

◆ dot() [2/2]

AFAPI array dot ( const array lhs,
const array rhs,
const matProp  optLhs = AF_MAT_NONE,
const matProp  optRhs = AF_MAT_NONE 
)