Thank you for the relevant links! The downside is that there does not seem to be a proposal to allow for more general base types within std::complex, e.g., __float128. This is actually my major complaint (that and fear of unstable complex arithmetic, especially division). Jack On Tue, Feb 7, 2012 at 1:19 PM, Chetan Jhurani <[email protected]>wrote:
I’ve faced similar issues with std::complex, but the material below,****
which is not in the C++ standard, has suppressed my fears. Not****
eliminated though.****
** **
http://fftw.org/doc/Complex-numbers.html (has a broken link, corrected below)****
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1388.pdf****
** **
Chetan****
** **
*From:* [email protected] [mailto: [email protected]] *On Behalf Of *Jack Poulson *Sent:* Tuesday, February 07, 2012 10:10 AM *To:* PETSc users list *Subject:* Re: [petsc-users] one compilation error in PETSc-dev with enabling GPU and complex number****
** **
On Tue, Feb 7, 2012 at 11:29 AM, Matthew Knepley <[email protected]> wrote:****
On Tue, Feb 7, 2012 at 11:20 AM, recrusader <[email protected]> wrote:* ***
Whether is it possible to find an efficient mechanism to do the conversion between std::complex and cusp::complex when the conversion is necessary.** **
** **
That does not matter. This is a compile error. We are not going to change this right now, and it seems like you are not going****
make the necessary changes, so I would say that complex numbers are not supported with our GPU code right now. The****
change would involve using cusp::complex for PetscScalar, and I am not sure how much work that would entail.****
** **
Matt****
Matt, ****
You might be interested to hear that the C++03 standard states that "The effect of instantiating the template complex for any type other than float, double or long double is unspecified". Thus, complex quad precision with it is probably a bad idea and, if I'm not mistaken, the standard does not state that the class must store data in the form
double real, imag;
so this could potentially break interfaces (e.g., to BLAS or LAPACK). Maybe it would be worthwhile to avoid usage of std::complex and simultaneously fix the compatibility issue with cusp::complex. I recently ripped std::complex out of Elemental for the above reasons.
Jack****