<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re:ippsThreshold_LTAbsVal_64f weird behaviour in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318529#M27791</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We have tried compiling and executing the shared code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;if( ABS(x[i]) &amp;lt; level ) y[i] = value;&lt;/P&gt;&lt;P&gt;else y[i] = x[i];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As per the absolute threshold formula, among the indices shared by you,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Considering 1st case 100&amp;nbsp;&lt;/P&gt;&lt;P&gt;Absolute of 100 which is 100 and greater than 1e-6. Hence the threshold doesn't get affected.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Considering 2nd case -95&lt;/P&gt;&lt;P&gt;Absolute of -95 which is 95 and greater than 1e-6. Hence the threshold doesn't get affected.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Kindly let us know if any difference in understanding.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Shanmukh.SS&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 01 Oct 2021 10:49:10 GMT</pubDate>
    <dc:creator>ShanmukhS_Intel</dc:creator>
    <dc:date>2021-10-01T10:49:10Z</dc:date>
    <item>
      <title>ippsThreshold_LTAbsVal_64f weird behaviour</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318301#M27789</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to use ippsThreshold_LTAbsVal_64f to replace small numbers by zero.&lt;/P&gt;
&lt;P&gt;According to the documentation a call like ippsThreshold_LTAbsVal_64f(xPtr, resultPtr, length, eps, 0.0) should replace all numbers in x that are in magnitude smaller than eps by zero.&lt;/P&gt;
&lt;P&gt;To quote the &lt;A href="https://software.intel.com/content/www/us/en/develop/documentation/ipp-dev-reference/top/volume-1-signal-and-data-processing/essential-functions/conversion-functions/ipp-ref-threshold-ltval-absval-gtval.html" target="_blank" rel="noopener"&gt;docs&lt;/A&gt;, the logic is:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;if( ABS(x[i]) &amp;lt; level ) y[i] = value;
else y[i] = x[i];&lt;/LI-CODE&gt;
&lt;P&gt;I have written the following C# program. I hope it is OK to post C# code, I also had no problems with any other IPP function from C# so far, only this one.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;static class IPP
{
	[SuppressUnmanagedCodeSecurity, DllImport("libippcore.so", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
	public static extern int ippInit();

	[SuppressUnmanagedCodeSecurity, DllImport("libipps.so", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
	public static extern unsafe int ippsThreshold_LTAbsVal_64f(double* pSrc, double* pDst, int len, double level, double value);
}

static class Program
{
	static unsafe void IppSanityCheck(int index1, int index2)
	{
		const int length = 10000;
		var array = new double[length];
		var result = new double[length];

		const double eps = 1e-6;
		// setting some indices to values |.| &amp;gt; eps
		array[index1] = 100.0;
		array[index2] = -95.0;

		for (var i = 0; i &amp;lt; length; i++)
		{
			if (array[i] != 0.0)
			{
				Console.WriteLine("Input index {0} contains non-zero value: {1}", i, array[i]);
			}
		}

		fixed (double* arrayPtr = array, resultPtr = result)
		{
			var statusCode = IPP.ippsThreshold_LTAbsVal_64f(arrayPtr, resultPtr, length, eps, 0);
			Console.WriteLine("{0} exited with {1}", nameof(IPP.ippsThreshold_LTAbsVal_64f), statusCode);
		}

		// expect same vector as result
		for (var i = 0; i &amp;lt; length; i++)
		{
			if (Math.Abs(array[i] - result[i]) &amp;gt; 1e-16)
			{
				Console.WriteLine("Result index {0} differs from input: {1} vs. {2}", i, array[i], result[i]);
			}
		}
	}

	static void Main(string[] args)
	{
		if (IPP.ippInit() == 0)
		{
			IppSanityCheck(534, 1096);
			IppSanityCheck(1,2);
		}
		return;
	}
}&lt;/LI-CODE&gt;
&lt;P&gt;This is the output:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;Input index 534 contains non-zero value: 100
Input index 1096 contains non-zero value: -95
ippsThreshold_LTAbsVal_64f exited with 0
Result index 534 differs from input: 100 vs. 0
Result index 1096 differs from input: -95 vs. 0
Input index 1 contains non-zero value: 100
Input index 2 contains non-zero value: -95
ippsThreshold_LTAbsVal_64f exited with 0
The program 'dotnet' has exited with code 0 (0x0).&lt;/LI-CODE&gt;
&lt;P&gt;As you can see when calling it with the first input (all zero except for indices 534 and 1096) the non-zero indices get replaced by zero (wrong). When calling it with the second input (now indices 1 and 2) they are not replaced (correct).&lt;/P&gt;
&lt;P&gt;Running on Docker/WSL2, x64, Debian 10, .NET 5, IPP is from the Intel APT repo:&lt;/P&gt;
&lt;LI-CODE lang="bash"&gt;# uname -a
Linux 2d1918de08d8 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 GNU/Linux
# dpkg -l | grep intel
ii  intel-oneapi-runtime-ipp           2021.3.0-333           amd64        Intel® Integrated Performance Primitives runtime
ii  intel-oneapi-runtime-ipp-common    2021.3.0-333           all          Intel® Integrated Performance Primitives runtime common
ii  intel-oneapi-runtime-openmp        2021.3.0-3350          amd64        Intel® OpenMP* Runtime Library runtime
ii  intel-oneapi-runtime-openmp-common 2021.3.0-3350          all          l_openmp.runtime.description&amp;gt;
ii  intel-oneapi-runtime-tbb           2021.3.0-511           amd64        Intel® oneAPI Threading Building Blocks runtime
ii  intel-oneapi-runtime-tbb-common    2021.3.0-511           all          Intel® oneAPI Threading Building Blocks runtime common
#&lt;/LI-CODE&gt;
&lt;P&gt;But I have tried on Windows as well and the behavior is the same.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;agildr&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 13:45:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318301#M27789</guid>
      <dc:creator>agildr</dc:creator>
      <dc:date>2021-09-30T13:45:44Z</dc:date>
    </item>
    <item>
      <title>Re:ippsThreshold_LTAbsVal_64f weird behaviour</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318529#M27791</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We have tried compiling and executing the shared code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;if( ABS(x[i]) &amp;lt; level ) y[i] = value;&lt;/P&gt;&lt;P&gt;else y[i] = x[i];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As per the absolute threshold formula, among the indices shared by you,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Considering 1st case 100&amp;nbsp;&lt;/P&gt;&lt;P&gt;Absolute of 100 which is 100 and greater than 1e-6. Hence the threshold doesn't get affected.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Considering 2nd case -95&lt;/P&gt;&lt;P&gt;Absolute of -95 which is 95 and greater than 1e-6. Hence the threshold doesn't get affected.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Kindly let us know if any difference in understanding.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Shanmukh.SS&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Oct 2021 10:49:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318529#M27791</guid>
      <dc:creator>ShanmukhS_Intel</dc:creator>
      <dc:date>2021-10-01T10:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: ippsThreshold_LTAbsVal_64f weird behaviour</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318997#M27792</link>
      <description>&lt;P&gt;Hi &lt;SPAN&gt;Shanmukh.SS&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, with the values supplied (0, -95, 100) the result should be the same as the input, since nothing ever is under the threshold (in magnitude), and zero already is equal to zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This works with the vector [0,100,-95,0,...,0] (length 10000).&amp;nbsp;However, in the case where I put the 100 at index 534 and -95 at index 1096 I get a different vector (all zeroes) back.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;agildr&lt;/P&gt;</description>
      <pubDate>Mon, 04 Oct 2021 08:12:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1318997#M27792</guid>
      <dc:creator>agildr</dc:creator>
      <dc:date>2021-10-04T08:12:54Z</dc:date>
    </item>
    <item>
      <title>Re:ippsThreshold_LTAbsVal_64f weird behaviour</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1319616#M27797</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank you for sharing the details. The issue is reproducible with indices 534 and 1096 for which the results should have been 100 and -95. Instead, it is returning 0.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We are looking into your issue. We will get back to you soon.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Shanmukh.SS&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Oct 2021 09:08:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1319616#M27797</guid>
      <dc:creator>ShanmukhS_Intel</dc:creator>
      <dc:date>2021-10-06T09:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: ippsThreshold_LTAbsVal_64f weird behaviour</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1320050#M27800</link>
      <description>&lt;P&gt;Hi A&lt;SPAN&gt;gildr.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I confirm this issue with ippsThreshold_LTAbsVal_64f.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Fix will be available in one of next IPP releases.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Andrey.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 15:55:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1320050#M27800</guid>
      <dc:creator>Andrey_B_Intel</dc:creator>
      <dc:date>2021-10-07T15:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: ippsThreshold_LTAbsVal_64f weird behaviour</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1321436#M27805</link>
      <description>&lt;P&gt;Hi Andrey,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply.&lt;/P&gt;
&lt;P&gt;Can you maybe offer any insights on which constellations trigger this bug?&lt;/P&gt;
&lt;P&gt;I'm asking because I have another test case, posting it below.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;const int len = 10000;
var x = new double[len];
var y = new double[len];
x[1] = 100;
x[2] = -95;
unsafe
{
  fixed (double* xPtr = x, yPtr = y)
  {
    IPP.ippsThreshold_LTAbsVal_64f(xPtr, yPtr, len, 0.01, 1000);
  }
}&lt;/LI-CODE&gt;
&lt;P&gt;First elements of y:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;1000
100	
-95	
1000
1000
0	
0	
1000
1000
0	
0	
1000
1000
0	
0	
1000&lt;/LI-CODE&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Luca&lt;/P&gt;</description>
      <pubDate>Tue, 12 Oct 2021 17:23:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippsThreshold-LTAbsVal-64f-weird-behaviour/m-p/1321436#M27805</guid>
      <dc:creator>agildr</dc:creator>
      <dc:date>2021-10-12T17:23:34Z</dc:date>
    </item>
  </channel>
</rss>

