DotProd

Computes the dot product of two vectors.

Syntax

Intel IPP style:

IppStatus ippsqDotProd_32f(const Ipp32f* pSrc1 , const Ipp32f* pSrc2 , Ipp32u len , Ipp32f* pDp );

IppStatus ippsqDotProdQ15Q30_16s64s(const Ipp16s* pSrc1 , const Ipp16s* pSrc2 , Ipp32u len , Ipp64s* pDp );

IppStatus ippsqDotProdQ31Q48_32s64s_Rms(const Ipp32s* pSrc1 , const Ipp32s* pSrc2 , Ipp32u len , Ipp64s* pDp );

IppStatus ippsqDotProd_32fc(const Ipp32fc* pSrc1 , const Ipp32fc* pSrc2 , Ipp32u len , Ipp32fc* pDp );

IppStatus ippsqDotProdQ15Q24_16sc32sc_Rm(const Ipp16sc* pSrc1 , const Ipp16sc* pSrc2 , Ipp32u len , Ipp32sc* pDp );

IppStatus ippsqDotProdQ31Q48_32sc64sc_Rm(const Ipp32sc* pSrc1 , const Ipp32sc* pSrc2 , Ipp32u len , Ipp64sc* pDp );

DSP style:

void ippsq_dot_prod_f32(const float32_t* pSrc1 , const float32_t* pSrc2 , uint32_t len , float32_t* pDp );

void ippsq_dot_prod_q15(const q15_t* pSrc1 , const q15_t* pSrc2 , uint32_t len , q63_t* pDp );

void ippsq_dot_prod_q31(const q31_t* pSrc1 , const q31_t* pSrc2 , uint32_t len , q63_t* pDp );

void ippsq_cmplx_dot_prod_f32(const float32_t* pSrc1 , const float32_t* pSrc2 , uint32_t len , float32_t* pDpRe , float32_t* pDpIm );

void ippsq_cmplx_dot_prod_q15(const q15_t* pSrc1 , const q15_t* pSrc2 , uint32_t len , q31_t* pDpRe , q31_t* pDpIm );

void ippsq_cmplx_dot_prod_q31(const q31_t* pSrc1 , const q31_t* pSrc2 , uint32_t len , q63_t* pDpRe , q63_t* pDpIm );

Include Files

ippsq.h

dsp.h

Parameters

pSrc1, pSrc2

Pointers to the source vectors.

pDp

Pointer to the result.

pDpRe

Pointer to the real part of the result (for DSP style).

pDpIm

Pointer to the imaginary part of the result (for DSP style).

len

Number of elements in the vector.

Description

This function computes the dot product (scalar value) of two vectors, pSrc1 and pSrc2, and stores the result in pDp. The computation is performed by the following formula:



Note

For complex flavors, multiplication is performed by complex numbers rules.

Vectors pSrc1 and pSrc2 must be of equal length.

Function flavor with the _Rms suffix additionally does the following:

  • Rounds down the result.

  • Performs saturation of the result if it exceeds the data range.

Functions flavors with the _Rm suffix round down the result.

Scaling, Truncation, Saturation

Function Description

ippsqDotProdQ15Q30_16s64s

ippsq_dot_prod_q15

The pSrc1 and pSrc2 values are represented in Q15 format. The output pDp value is a 64-bit internal accumulator in Q34.30 format, so it preserves full precision of intermediate calculations and avoids internal overflow.

ippsqDotProdQ15Q24_16sc32sc_Rm

ippsq_cmplx_dot_prod_q15

The pSrc1 and pSrc2 values are represented in Q15 complex format. The function uses a 64-bit internal accumulator in Q34.30 format, so it preserves full precision of intermediate calculations and avoids internal overflow. In the end, the function shifts the accumulator right by 6 bits and does not perform saturation. After accumulator conversion, the output pDp complex value is in Q8.24.

ippsqDotProdQ31Q48_32s64s_Rmsm

ippsq_dot_prod_q31

The pSrc1 and pSrc2 values are represented in Q15 complex format. The function uses a 64-bit internal accumulator in Q66.62 format, so it preserves full precision of intermediate calculations and avoids internal overflow. In the end, the function saturates the output in [IPP_MIN_64S, IPP_MAX_64S] range to store in the pDp 64-bit output value.

ippsqDotProdQ31Q48_32sc64sc_Rm

ippsq_cmplx_dot_prod_q31

The pSrc1 and pSrc2 values are represented in Q31 complex format. The function shifts right the result of complex multiplication of Q31 numbers pSrc1 and pSrc2, truncates it to Q16.48, and adds it to the accumulator. The function is not protected from internal overflow. In the end, the function does not perform saturation.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.
For more complete information about compiler optimizations, see our Optimization Notice.