forum.alglib.net

ALGLIB forum
It is currently Sat Apr 27, 2024 4:30 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: how convert complex data?
PostPosted: Mon Mar 17, 2014 1:58 pm 
Offline

Joined: Mon Mar 17, 2014 1:16 pm
Posts: 1
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?


Top
 Profile  
 
 Post subject: Re: how convert complex data?
PostPosted: Wed Mar 19, 2014 9:07 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 906
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 315 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group