Dag Sverre Seljebotn wrote:
> What is needed, help where you can: > > a) Explain/dig up references about the C++ complex type. I think this is the most up-to-date reference, but not yet adopted: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2960.pdf One tricky area. How to get/put the real/imag values? This seems to have evolved. First there are both member and non-member functions for real() and imag(). Second, seems to have evolved as to whether these return lvalues. Meaning, on gcc-4.4.1 today this should work: real(z) = 2 But reading the above standard, I think the way to put real, imag values would be: z.real (2) I believe the non-member versions in c++0x only allow getting the value -------------------- #include <complex> void foo () { typedef std::complex<double> complex_t; complex_t z; z.real(2); real (z) = 2; } ---------------------- gcc-4.4.1 normal mode: OK gcc-4.4.1 -std=c++0x: test_complex.cc:10: error: lvalue required as left operand of assignment So: typedef std::complex<double> complex_t 1) create complex: complex_t z (x, y); or complex_t z = complex_t (x, y) 2) get real/imag part: double x = z.real() or double x = real(z) 3) put real/imag parg: z.real(x) Note: z.real()=x used to work but not going forward z.real is a member function, not the data! _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev