I have 2 pointers which points to two 20 member arrays. My arrays contains complex numbers. I want to make element by element division for that complex numbers that is why I need to separate numbers to real and imaginary parts. I tried the following code but it gives error.
#include <complex>
complex *a;
complex *b;
complex array1[20];
complex array2[20];
a = &array1;
b = &array2;
int i=0;
for (i=0;i<=19;i++)
{
real_part_array1[i] = real(*a[i]);
imag_part_array1[i] = imag(*a[i]);
real_part_array2[i] = real(*b[i]);
imag_part_array2[i] = imag(*b[i]);
}
First error I got was; I tried to write it as
#include <complex.h>
the error message was "cannot open source file complex.h". Then i deleted h and error was gone. The second error I have is for real() and imag(). The error message is "identifier real is undefined".
For division I have to seperate them to real and imaginary parts but I dont know how to solve that problem. I hope you guys can help me.