forum.alglib.net
http://forum.alglib.net/

how convert complex data?
http://forum.alglib.net/viewtopic.php?f=2&t=1594
Page 1 of 1

Author:  romanrex [ Mon Mar 17, 2014 1:58 pm ]
Post subject:  how convert complex data?

Code:
           
double[] x = new double[] { 1, 1, 1, 1 };
alglib.complex[] f;
double[] x2;
alglib.fftr1d(x, out f);
//   System.Console.WriteLine("{0}", alglib.ap.format(f, 3)); // EXPECTED: [4,0,0,0]
textBox_info_main.Text += "FF " + alglib.ap.format(f, 3) + Environment.NewLine; // EXPECTED: FF {4.000+0.000i,0.000+0.000i,0.000-0.000i,0.000+0.000i}
for (int i = 0; i < f.Length; i++)
{
textBox_info_main.Text += "FI " + f[i] + Environment.NewLine; //EXPECTED: FI alglib+complex
}

how convert f[i] "alglib+complex" in double?

Author:  Sergey.Bochkanov [ Wed Mar 19, 2014 9:07 am ]
Post subject:  Re: how convert complex data?

You may use f[].x and f[].y to work with real and imaginary parts of the complex number. This is the only way to "convert" complex to double. If you are pretty sure that complex value is strictly real (imaginary part is zero), you may just work with f[].x

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/