Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Help with ippmL2Norm and zero vectors

samueleforconi
Beginner
259 Views
Hi, I was trying to compute the norm of some vector and vector arrays.
My question is: why the function "ippmL2Norm" returns -1.#IO when
in input there is a vector with all 0 components?
According to the formula on the manual I think that it should return 0.

This is the piece of code that I use for test:

Ipp32f c[5*3] = { 1.0f, 2.0f, 3.0f,
0.0f, 0.0f, 0.0f,
7.0f, 8.0f, 9.0f,
3.0f, 1.0f, 8.0f,
9.0f, 6.0f, 4.0f };
Ipp32f d[5*3] = { 3.0f, 5.0f, 6.0f,
5.0f, 1.0f, 1.0f,
7.0f, 8.0f, 3.0f,
1.0f, 9.0f, 5.0f,
2.0f, 2.0f, 6.0f };
Ipp32f e[3] = { 0.0f, 0.0f, 0.0f };

int cstride0 = sizeof(Ipp32f)*3;
int cstride2 = sizeof(Ipp32f);
int dstride0 = sizeof(Ipp32f)*3;
int dstride2 = sizeof(Ipp32f);
int estride2 = sizeof(Ipp32f);

int len = 3;
int count = 5;
int i = 0;

Ipp32f dst[5];
Ipp32f c_nor[5];
Ipp32f d_nor[5];
Ipp32f e_nor;

ippmDotProduct_vava_32f(c, cstride0, cstride2, d, dstride0, dstride2, dst, len, count);

ippmL2Norm_va_32f(c, cstride0, cstride2, c_nor, len, count);
ippmL2Norm_va_32f(d, dstride0, dstride2, d_nor, len, count);
ippmL2Norm_v_32f(e, estride2, &e_nor, len);

printf("Dot Prod ");
for(i=0;i<5;i++)
printf("[%d] = %.3f ",i,dst);
printf(" Norm of vector array c: ");
for(i=0;i<5;i++)
printf("[%d] = %.3f ",i,c_nor);
printf(" Norm of vector array d: ");
for(i=0;i<5;i++)
printf("[%d] = %.3f ",i,d_nor);
printf(" Norm of vector e: %.3f", e_nor);


And in output I have:
Dot Prod
[0] = 31.000
[1] = 0.000
[2] = 140.000
[3] = 52.000
[4] = 54.000

Norm of vector array c:
[0] = 3.742
[1] = -1.#IO
[2] = 13.928
[3] = 8.602
[4] = 11.533

Norm of vector array d:
[0] = 8.367
[1] = 5.196
[2] = 11.045
[3] = 10.344
[4] = 6.633

Norm of vector e: -1.#IO

I can't understand where is my error, thank you for your help.
Samuele.
0 Kudos
3 Replies
Vladimir_Dudnik
Employee
259 Views

Hi Samuele,

could you please specify what version of IPP do you use, how do you link that and what is your target platform and OS?

Regards,
Vladimir

0 Kudos
samueleforconi
Beginner
259 Views
Hi,
thank you for your answer.

I'm actually using Intel IPP v5.2 for Windows on IA-32.
I use dynamic linkage (to ippm.lib from directory stublib).

Regards,
Samuele.
0 Kudos
Vladimir_Dudnik
Employee
259 Views

Hello,

there is comment from our expert:

Function ippmL2Norm really returns -1.#IO in case of input vector with all 0 components for vector length =3,4,5,6 on IA32&EM64t architecture.

This implementation error will be corrected to IPP 6.0 version.

Regards,
Vladimir

0 Kudos
Reply