Div

Divides the elements of two vectors.

Syntax

Case 1. Not-in-place operations on integer data.

IppStatus ippsDiv_8u_Sfs(const Ipp8u* pSrc1, const Ipp8u* pSrc2, Ipp8u* pDst, int len, int scaleFactor);

IppStatus ippsDiv_16u_Sfs(const Ipp16u* pSrc1, const Ipp16u* pSrc2, Ipp16u* pDst, int len, int scaleFactor);

IppStatus ippsDiv_16s_Sfs(const Ipp16s* pSrc1, const Ipp16s* pSrc2, Ipp16s* pDst, int len, int scaleFactor);

IppStatus ippsDiv_32s_Sfs(const Ipp32s* pSrc1, const Ipp32s* pSrc2, Ipp32s* pDst, int len, int scaleFactor);

IppStatus ippsDiv_16sc_Sfs(const Ipp16sc* pSrc1, const Ipp16sc* pSrc2, Ipp16sc* pDst, int len, int scaleFactor);

IppStatus ippsDiv_32s16s_Sfs(const Ipp16s* pSrc1, const Ipp32s* pSrc2, Ipp16s* pDst, int len, int scaleFactor);

Case 2. Not-in-place operations on floating point data.

IppStatus ippsDiv_32f(const Ipp32f* pSrc1, const Ipp32f* pSrc2, Ipp32f* pDst, int len);

IppStatus ippsDiv_64f(const Ipp64f* pSrc1, const Ipp64f* pSrc2, Ipp64f* pDst, int len);

IppStatus ippsDiv_32fc(const Ipp32fc* pSrc1, const Ipp32fc* pSrc2, Ipp32fc* pDst, int len);

IppStatus ippsDiv_64fc(const Ipp64fc* pSrc1, const Ipp64fc* pSrc2, Ipp64fc* pDst, int len);

Case 3. In-place operations on integer data.

IppStatus ippsDiv_8u_ISfs(const Ipp8u* pSrc, Ipp8u* pSrcDst, int len, int ScaleFactor);

IppStatus ippsDiv_16u_ISfs(const Ipp16u* pSrc, Ipp16u* pSrcDst, int len, int scaleFactor);

IppStatus ippsDiv_16s_ISfs(const Ipp16s* pSrc, Ipp16s* pSrcDst, int len, int ScaleFactor);

IppStatus ippsDiv_16sc_ISfs(const Ipp16sc* pSrc, Ipp16sc* pSrcDst, int len, int ScaleFactor);

IppStatus ippsDiv_32s_ISfs(const Ipp32s* pSrc, Ipp32s* pSrcDst, int len, int ScaleFactor);

Case 4. In-place operations on floating point data

IppStatus ippsDiv_32f_I(const Ipp32f* pSrc, Ipp32f* pSrcDst, int len);

IppStatus ippsDiv_64f_I(const Ipp64f* pSrc, Ipp64f* pSrcDst, int len);

IppStatus ippsDiv_32fc_I(const Ipp32fc* pSrc, Ipp32fc* pSrcDst, int len);

IppStatus ippsDiv_64fc_I(const Ipp64fc* pSrc, Ipp64fc* pSrcDst, int len);

Parameters

pSrc1

Pointer to the vector whose elements are used as divisors.

pSrc2

Pointer to the vector whose elements are used as dividends.

pDst

Pointer to the destination vector.

pSrc

Pointer to the source vector whose elements are used as divisors for in-place operations.

pSrcDst

Pointer to the source and destination vector for in-place operations.

len

Number of elements in the vector

scaleFactor

Scale factor, refer to Integer Scaling.

Description

The function ippsDiv is declared in the ipps.h file. This function divides the elements of the vector pSrc2 by the elements of the vector pSrc1, and stores the result in pDst.

The in-place flavors of ippsDiv divide the elements of the vector pSrcDst by the elements of the vector pSrc and store the result in pSrcDst.

Functions with Sfs suffixes perform scaling of the result value in accordance with the scaleFactor value. If the output value exceeds the data range, the result becomes saturated.

If the function ippsDiv encounters a zero-valued divisor vector element, it returns a warning status and continues execution with the corresponding result value (see appendix A "Handling of Special Cases" for more information).

Example "Using the ippsDiv_16s_ISfs Function " shows that the use of the scaling factor in the integer functions increases operation accuracy. Example "Using the ippsDiv_32f_I Function" considers division by zero exceptions (x / 0, 0 / 0).

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when any of the specified pointers is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

ippStsDivByZero

Indicates a warning for zero-valued divisor vector element.

Using the ippsDiv_16s_ISfs Function

IppStatus div16s( void ) {
      Ipp16s x[4] = { -3, 2, 0, 300 };
      Ipp16s y[4] = { -2, 2, 0, 0 };
      IppStatus st = ippsDiv_16s_ISfs( y, x, 4, -1 );
      printf_16s(“div16s =”, x, 4, st );
      return st;
}
Output:
    -- warning 6, Zero value(s) in the divisor of the function Div
    div16s =  3 2 0 32767

Using the ippsDiv_32f_I Function

IppStatus div32f( void ) {
      Ipp32f x[4] = { -3, 2, 0, 300 };
      Ipp32f y[4] = { -2, 2, 0, 0 };
      IppStatus st = ippsDiv_32f_I( y, x, 4 );
      printf_32f( "div32f =", x, 4, st );
      return st;
}
Output:
    -- warning 6, Zero value(s) in the divisor of the function Div
    div32f =  1.500000 1.000000 1.#IND00 1.#INF00

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.