Abs

Computes absolute values of vector elements.

Syntax

IppStatus ippsAbs_16s(const Ipp16s* pSrc, Ipp16s* pDst, int len);

IppStatus ippsAbs_32s(const Ipp32s* pSrc, Ipp32s* pDst, int len);

IppStatus ippsAbs_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len);

IppStatus ippsAbs_64f(const Ipp64f* pSrc, Ipp64f* pDst, int len);

IppStatus ippsAbs_16s_I(Ipp16s* pSrcDst, int len);

IppStatus ippsAbs_32s_I(Ipp32s* pSrcDst, int len);

IppStatus ippsAbs_32f_I(Ipp32f* pSrcDst, int len);

IppStatus ippsAbs_64f_I(Ipp64f* pSrcDst, int len);

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

pSrcDst

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

len

Number of elements in the vector.

Description

The function ippsAbs is declared in the ipps.h file. This function computes the absolute values of each element of the vector pSrc and stores the result in pDst. The in-place flavors of ippsAbs compute the absolute values of each element of the vector pSrcDst and store the result in pSrcDst.

To compute the absolute values of complex data, use the function ippsMagnitudeippsMagnitude.

The example below shows how to call the function ippsAbs_32f_I.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pSrc, pDst, or pSrcDst pointer is NULL.

ippStsSizeErr

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

Using the ippsAbs Function

void abs32f(void) {
      Ipp32f x[4] = {-1, 1, 0, 0};
      x[3] *= (-1);
      ippsAbs_32f_I(x, 4);
      printf_32f(“abs =”, x, 4, ippStsNoErr);
}
Output: 
    abs =  1.000000 1.000000 0.000000 0.000000

Submit feedback on this help topic

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