C complex number usage

Bruce Labitt bruce.labitt at verizon.net
Sun Jan 6 17:14:06 EST 2008


I did find a solution.  Not online though...  From brute force try 
anything...
This snippet does work.  However, as noted in the code, even though the 
standard says it will work - it didn't...

#include <cstdlib>
#include <iostream>
#include <complex>
using namespace std;
using std::complex;

int main(int argc, char *argv[])
{
    int ii,N;
    N=1;
    double a, b;
    complex <double> c(10.8, 2.5);
    //double realpart,imagpart;
   
    a = 1.0;    // a is the real part
    b = 2.1;    // b is the imaginary part
    // c = a,b;  // This does not form the complex number!!!
                 // although the documentation says otherwise!
                // this prints out (1.0,0) not (1.0,2.1)
    cout << c << endl;
    c = complex<double>(a,b); 
    cout << c << endl;
     
    system("PAUSE");
    return EXIT_SUCCESS;
}

Back to my original problem... Massively long FFTs on complex data.


Michael ODonnell wrote:
>   
>>> What's the compiler version?
>>>       
>>  I can tell from the directory path in his original post that
>> it's almost certainly some flavor of Microsoft Visual C++.
>>     
>
> Yah, I also noticed that pathname but thought it possible he
> was maybe using some flavor of something like Cygwin.
>
> 	[...]
>   
>>> Also, if you post your code here ...
>>>       
>>  Ummm... didn't he already do that?  :)
>>     
>
> Sort of, but I'm talking about a complete, minimal file that
> repro's the problem he's talking about.  And it's possible
> that in the process of whittling it down to the minimal
> problem-demo code he'll stumble across a solution...
>  
> _______________________________________________
> gnhlug-discuss mailing list
> gnhlug-discuss at mail.gnhlug.org
> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
>
>   



More information about the gnhlug-discuss mailing list