Community
cancel
Showing results for 
Search instead for 
Did you mean: 
needle__brosh
Beginner
53 Views

sing of 32 float

Hi, 

I need to get the sign value of each element in a vector.

is there a simple way to do so. 

exp: 

input: (32float)  1.26 0 63.54 -8.3 -1.2 1.6 5 -9 ....

output:   1    1  1   -1 -1 1 1 -1 

 

thanks 

0 Kudos
3 Replies
Chao_Y_Intel
Employee
53 Views

Hello, 

Can you check the ippsThreshold_LTValGTVal  function?

Thanks,
Chao

Zhen_Z_Intel
Employee
53 Views

Dear customer,

You could use IPP threshold_LT & GT function, for instance:

ippsThreshold_LT_32s(pSrc, pDst, len, -1); //replace all value with -1, if <-1
ippsThreshold_GT_32s(pSrc, pDst, len, 1); //otherwise set to 1

Hope it would be useful to you.

Best regards,
Fiona

Igor_A_Intel
Employee
53 Views

Hi,

another, may be the fastest, method is to use ippsRShiftC functions - just cast pointers as (Ipp32s*) and shift on 31:

IPPAPI(IppStatus, ippsRShiftC_32s,   (const Ipp32s* pSrc, int val, Ipp32s* pDst,    int len))

and then in-place ippsOrC with 1 (cast pointers as Ipp32u):

IPPAPI(IppStatus, ippsOrC_32u_I, (                    Ipp32u val, Ipp32u* pSrcDst, int len))

regards, Igor

Reply