Thank you for the relevant links!<br><br>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).<br>
<br>Jack<br><br><div class="gmail_quote">On Tue, Feb 7, 2012 at 1:19 PM, Chetan Jhurani <span dir="ltr"><<a href="mailto:chetan.jhurani@gmail.com">chetan.jhurani@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif"">I’ve faced similar issues with std::complex, but the material below,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif"">which is not in the C++ standard, has suppressed my fears. Not<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif"">eliminated though.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif""><a href="http://fftw.org/doc/Complex-numbers.html" target="_blank">http://fftw.org/doc/Complex-numbers.html</a> (has a broken link, corrected below)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif""><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1388.pdf" target="_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1388.pdf</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif"">Chetan<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"Verdana","sans-serif""><u></u> <u></u></span></p><div style="border-width:medium medium medium 1.5pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color blue;padding:0in 0in 0in 4pt">
<div><div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(181,196,223) -moz-use-text-color -moz-use-text-color;padding:3pt 0in 0in"><p class="MsoNormal"><b><span style="font-size:10pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10pt;font-family:"Tahoma","sans-serif""> <a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a> [mailto:<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a>] <b>On Behalf Of </b>Jack Poulson<br>
<b>Sent:</b> Tuesday, February 07, 2012 10:10 AM<br><b>To:</b> PETSc users list<br><b>Subject:</b> Re: [petsc-users] one compilation error in PETSc-dev with enabling GPU and complex number<u></u><u></u></span></p></div></div>
<div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">On Tue, Feb 7, 2012 at 11:29 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<u></u><u></u></p>
<div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div><p class="MsoNormal">On Tue, Feb 7, 2012 at 11:20 AM, recrusader <<a href="mailto:recrusader@gmail.com" target="_blank">recrusader@gmail.com</a>> wrote:<u></u><u></u></p></div><div><div><blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Whether is it possible to find an efficient mechanism to do the conversion between std::complex and cusp::complex when the conversion is necessary.<u></u><u></u></p></blockquote><div><p class="MsoNormal">
<u></u> <u></u></p></div></div><div><p class="MsoNormal">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<u></u><u></u></p></div><div><p class="MsoNormal">
make the necessary changes, so I would say that complex numbers are not supported with our GPU code right now. The<u></u><u></u></p></div><div><p class="MsoNormal">change would involve using cusp::complex for PetscScalar, and I am not sure how much work that would entail.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal"> Matt<u></u><u></u></p></div></div></blockquote><div><p class="MsoNormal"><br>Matt, <u></u><u></u></p></div><div><p class="MsoNormal"><br>
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<br>
<br>double real, imag;<br><br>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.<br>
<br>Jack<u></u><u></u></p></div></div></div></div></div></div></div></blockquote></div><br>