My Project

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

Functions

AFAPI array dot (const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
 Dot Product. More...
 
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. More...
 

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.


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

◆ dot()

AFAPI array af::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));
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
Returns
out = dot(lhs, rhs)
af_print
#define af_print(...)
Definition: util.h:140
af::randu
AFAPI array randu(const dim4 &dims, const dtype ty=f32)
af::print
AFAPI void print(const char *exp, const array &arr)
af::dot
AFAPI array dot(const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
Dot Product.
afcl::array
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:328