Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Threshold_LTInv

Computes the inverse of vector elements after limiting their magnitudes by the given lower bound.

Syntax

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

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

IppStatus ippsThreshold_LTInv_32fc(const Ipp32fc* pSrc, Ipp32fc* pDst, int len, Ipp32f level);

IppStatus ippsThreshold_LTInv_64fc(const Ipp64fc* pSrc, Ipp64fc* pDst, int len, Ipp64f level);

IppStatus ippsThreshold_LTInv_32f_I(Ipp32f* pSrcDst, int len, Ipp32f level);

IppStatus ippsThreshold_LTInv_64f_I(Ipp64f* pSrcDst, int len, Ipp64f level);

IppStatus ippsThreshold_LTInv_32fc_I(Ipp32fc* pSrcDst, int len, Ipp32f level);

IppStatus ippsThreshold_LTInv_64fc_I(Ipp64fc* pSrcDst, int len, Ipp64f level);

Include Files

ipps.h

Domain Dependencies

Headers: ippcore.h, ippvm.h

Libraries: ippcore.lib, ippvm.lib

Parameters

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

pSrcDst

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

len

Number of elements in the vector.

level

Value used to limit each element of pSrc or pSrcDst.This argument must always be real and positive.

Description

This function computes the inverse of elements of the vector pSrc and stores the result in pDst. The computation occurs after first limiting the magnitude of each element by the threshold value level.

The in-place flavors of ippsThreshold_LTInv compute the inverse of elements of the vector pSrcDst and store the result in pSrcDst. The computation occurs after first limiting the magnitude of each element by the threshold value level.

The threshold operation is performed to avoid division by zero. Since level represents a magnitude, it is always real and must be positive. The formula for ippsThreshold_LTInv is the following:



If the function encounters zero-valued vector elements and level is also 0 (see appendix A "Handling of Special Cases"), the output value is set to Inf (infinity), but operation execution is not aborted:



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 zero.

ippStsThreshNegLevelErr

Indicates an error when level is negative.

ippStsInvZero

Indicates a warning when level and a vector element are equal to zero. Operation execution is not aborted. The value of the destination vector element is Inf.

Example

Threshold_LtInv:

/*******************************************************************************
* 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()
{
    Ipp32f pVals[] = { 1, 3, 5, 7, 18, 24, 35, 48 };
    Ipp32f pOutVals[8];
    IppStatus status;
    int i;

    printf("Source vector\n");
    for (i = 0; i < 8; i++) printf("%f ", pVals[i]);

    check_sts(status = ippsThreshold_LTInv_32f(pVals, pOutVals, 8, 2));

    printf("Result values vector\n");
    for (i = 0; i < 8; i++) printf("%f ", pOutVals[i]);

EXIT_MAIN
    printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
    return (int)status;
}

Threshold_LtInv_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()
{
    Ipp32f pVals[] = { 1, 3, 5, 7, 18, 24, 35, 48 };
    IppStatus status;
    int i;

    printf("Source vector\n");
    for (i = 0; i < 8; i++) printf("%f ", pVals[i]);

    check_sts(status = ippsThreshold_LTInv_32f_I(pVals, 8, 2));

    printf("Result values vector\n");
    for (i = 0; i < 8; i++) printf("%f ", pVals[i]);

EXIT_MAIN
    printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
    return (int)status;
}