SortAscend, SortDescend

Sorts all elements of a vector.

Syntax

IppStatus ippsSortAscend_8u_I(Ipp8u* pSrcDst, int len);

IppStatus ippsSortAscend_16u_I(Ipp16u* pSrcDst, int len);

IppStatus ippsSortAscend_16s_I(Ipp16s* pSrcDst, int len);

IppStatus ippsSortAscend_32s_I(Ipp32s* pSrcDst, int len);

IppStatus ippsSortAscend_32f_I(Ipp32f* pSrcDst, int len);

IppStatus ippsSortAscend_64f_I(Ipp64f* pSrcDst, int len);

IppStatus ippsSortDescend_8u_I(Ipp8u* pSrcDst, int len);

IppStatus ippsSortDescend_16u_I(Ipp16u* pSrcDst, int len);

IppStatus ippsSortDescend_16s_I(Ipp16s* pSrcDst, int len);

IppStatus ippsSortDescend_32s_I(Ipp32s* pSrcDst, int len);

IppStatus ippsSortDescend_32f_I(Ipp32f* pSrcDst, int len);

IppStatus ippsSortDescend_64f_I(Ipp64f* pSrcDst, int len);

Parameters

pSrcDst

Pointer to the source and destination vector.

len

Number of elements in the vector

Description

The functions ippsSortAscend and ippsSortDescend are declared in the ipps.h file. These functions rearrange all elements of the source vector pSrcDst in the ascending or descending order, respectively, and store the result in the destination vector pSrcDst.

The example below shows how to call the function ippsSortAscend_8u_I.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when the pSrcDst is NULL.

ippStsSizeErr

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

Using the Function ippsSortAscend

void func_sort()
{
    Ipp8u vec[10] = {0,2,4,5,1,8,9,4,6,7};
    IppStatus status;
		
    status = ippsSortAscend_8u_I(vec,10);
    if(ippStsNoErr != status)
      printf("IPP Error: %s",ippGetStatusString(status));
}

		
Result
      0 1 2 4 4 5 6 7 8 9

Submit feedback on this help topic

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