S
seia0106
Hello,
Writing a program in c++ that should use complex numbers I have two
choices before me.
1- define a struct for complex data i.e
struct {float real,imag;
}ComplexNum;
2-use an array of float type
float Array[]
and consider its even and odd indices as real and imaginary parts of
data respectively.
I must add that the program loops have to do lot of iterations for
multiplications and additions of complex numbers.
Right now choice one seems to have one advantage that it would easy to
see real and imag seperately instead of worrying about the correct
value of indices. But clearity alone is not all that is needed in this
case.
Would someone please comment on the above two approaches, their
differences, effect on performance/speed, and their pros and cons.
Thanks in advance
Writing a program in c++ that should use complex numbers I have two
choices before me.
1- define a struct for complex data i.e
struct {float real,imag;
}ComplexNum;
2-use an array of float type
float Array[]
and consider its even and odd indices as real and imaginary parts of
data respectively.
I must add that the program loops have to do lot of iterations for
multiplications and additions of complex numbers.
Right now choice one seems to have one advantage that it would easy to
see real and imag seperately instead of worrying about the correct
value of indices. But clearity alone is not all that is needed in this
case.
Would someone please comment on the above two approaches, their
differences, effect on performance/speed, and their pros and cons.
Thanks in advance