Visible to Intel only — GUID: GUID-55B62F5A-E2A1-43FA-8406-39A0F4D5A5F5
Visible to Intel only — GUID: GUID-55B62F5A-E2A1-43FA-8406-39A0F4D5A5F5
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);
Include Files
ipps.h
Domain Dependencies
Headers: ippcore.h, ippvm.h
Libraries: ippcore.lib, ippvm.lib
Parameters
pSrc1 |
Pointer to the divisor vector. |
pSrc2 |
Pointer to the dividend vector. |
pDst |
Pointer to the destination vector. |
pSrc |
Pointer to the divisor vector 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
This function divides the elements of the pSrc2 vector by the elements of the pSrc1 vector , 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 suffixe perform scaling of the result in accordance with the scaleFactor value. If the output value exceeds the data range, the result is saturated.
If any of the divisor vector elements is equal to zero, the function returns a warning and continues execution with the corresponding result value. For more information see "Handling of Special Cases".
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 zero. |
ippStsDivByZero |
Indicates a warning when any of the divisor vector elements is equal to zero. |
Example
Div:
/*******************************************************************************
* Copyright 2015 Intel Corporation.
*
*
* This software and the related documents are Intel copyrighted materials, and your use of them is governed by
* the express license under which they were provided to you ('License'). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related
* documents without Intel's prior written permission.
* This software and the related documents are provided as is, with no express or implied warranties, other than
* those that are expressly stated in the License.
*******************************************************************************/
#include <stdio.h>
#include "ipp.h"
/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine: /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel(R) Integrated Performance Primitives (Intel(R) IPP) function returned status different from ippStsNoErr */
/* Results of ippMalloc() are not validated because Intel(R) IPP functions perform bad arguments check and will return an appropriate status */
int main()
{
int len = 32;
int i;
Ipp64f *pDst = ippsMalloc_64f(len * sizeof(Ipp64f));
Ipp64f *pSrc1 = ippsMalloc_64f(len * sizeof(Ipp64f));
Ipp64f *pSrc2 = ippsMalloc_64f(len * sizeof(Ipp64f));
IppStatus status;
printf("\n\nSource vector 1\n");
for (i = 0; i < len; i++)
{
pSrc1[i] = i;
printf("%.0f; ", pSrc1[i]);
}
printf("\n\nSource vector 2\n");
for (i = 0; i < len; i++)
{
pSrc2[i] = 10 + i;
printf("%.0f; ", pSrc2[i]);
}
check_sts(status = ippsDiv_64f(pSrc2, pSrc1, pDst, len));
printf("\n\nResult\n");
for (i = 0; i < len; i++) printf("%.2f; ", pDst[i]);
printf("\n\n");
EXIT_MAIN
ippsFree(pSrc1);
ippsFree(pSrc2);
ippsFree(pDst);
printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
return (int)status;
}
Div_I:
/*******************************************************************************
* Copyright 2015 Intel Corporation.
*
*
* This software and the related documents are Intel copyrighted materials, and your use of them is governed by
* the express license under which they were provided to you ('License'). Unless the License provides otherwise,
* you may not use, modify, copy, publish, distribute, disclose or transmit this software or the related
* documents without Intel's prior written permission.
* This software and the related documents are provided as is, with no express or implied warranties, other than
* those that are expressly stated in the License.
*******************************************************************************/
#include <stdio.h>
#include "ipp.h"
/* Next two defines are created to simplify code reading and understanding */
#define EXIT_MAIN exitLine: /* Label for Exit */
#define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel(R) Integrated Performance Primitives (Intel(R) IPP) function returned status different from ippStsNoErr */
/* Results of ippMalloc() are not validated because Intel(R) IPP functions perform bad arguments check and will return an appropriate status */
int main()
{
int len = 32;
int i;
Ipp64f *pSrc1 = ippsMalloc_64f(len * sizeof(Ipp64f));
Ipp64f *pSrcDst = ippsMalloc_64f(len * sizeof(Ipp64f));
IppStatus status;
printf("\n\nSource vector 1\n");
for (i = 0; i < len; i++)
{
pSrcDst[i] = i;
printf("%.0f; ", pSrcDst[i]);
}
printf("\n\nSource vector 2\n");
for (i = 0; i < len; i++)
{
pSrc1[i] = 10 + i;
printf("%.0f; ", pSrc1[i]);
}
check_sts(status = ippsDiv_64f_I(pSrc1, pSrcDst, len));
printf("\n\nResult\n");
for (i = 0; i < len; i++) printf("%.2f; ", pSrcDst[i]);
printf("\n\n");
EXIT_MAIN
ippsFree(pSrc1);
ippsFree(pSrcDst);
printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
return (int)status;
}