Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

MKL_Complex16 arrays for mathematical operations problems

MooN_K_
Beginner
334 Views

Hello everyone

I am using icc compiler to deal with my mkl_complex16 arrays, i was trying out my mathematical formula that i want to implement on the mic... but i got these errors:

essai.c(136): error: expression must have struct or union type
                sum.real= sum.real+w.real*y_in.real[z+1][s+1];
                                          ^

essai.c(137): error: expression must have struct or union type
                sum.imag= sum.imag+w.imag*y_in.imag[z+1][s+1];
                                          ^

Here is my code:

MKL_Complex16 y_in[4][16];

MKL_Complex16 w,sum;
int s,z,y; 

int l =20;

int nThreads =4;

for (s=0;s<(l-1);s++)
{    
    for(z=0;z<(nThread-1);z++)
    {    
         
        for(y=0;y<(nThread-1);y++)
        {    
             w.real= y; 
             w.imag=-y;
        sum.real= sum.real+w.real*y_in.real[z+1][s+1];
        sum.imag= sum.imag+w.imag*y_in.imag[z+1][s+1];
        }
    }
}

Any help would be apperciated

Thank you

 

0 Kudos
1 Reply
Ying_H_Intel
Employee
334 Views

Hi MooN K.

I try build your code and the error looks be in y_in.real[z+1][s+1]. 

complex16.cpp(28): error: expression must have class type

          sum.real= sum.real+w.real*y_in.real[z+1][s+1];

You can fix the problem as below

sum.real=0;

sum.imag=0;

....

sum.real= sum.real+w.real*y_in[z+1][s+1].real;
sum.imag= sum.imag+w.imag*y_in[z+1][s+1].imag;

Regards,

Ying

0 Kudos
Reply