I have a array of type ILArray thats comes as an output from FFT function. I want to further perform some math operations on the real and imaginary parts.
For example: complexArray.realPart * 2 + complexArray.imaginaryPart * 4 ???
I have a array of type ILArray thats comes as an output from FFT function. I want to further perform some math operations on the real and imaginary parts.
For example: complexArray.realPart * 2 + complexArray.imaginaryPart * 4 ???
You have found the solution already. I'll put the answer here for sake of completeness.
Using ILMath.real() and ILMath.imag() gives access to the real and imaginary part of ILArray. If you are operating on the elements, using the properties .real and .imag of ILNumerics.fcomplex might be another option:
// create test array of complex elements
ILArray<fcomplex> C = ccomplex(ones<float>(1,10), -ones<float>(1,10));
// using real(), imag()
ILArray<float> a1 = 2 * real(C) + 4 * imag(C);
// using direct access to real / imag part of complex elements
foreach (var c in C) {
float a2 = c.real * 2 + 4 * c.imag;
// ...
}