Barry,<br><br>Believe me, I apologize if it came across as me trying to dump something else on your plates. I was simply trying to point out some shortcomings of standard approaches to complex numbers. <br><br>I know that PETSc supports quad precision for real numbers, but it seems that there isn't yet a good way to do so for the complex case, as it would require a custom complex class. If not, please let me know!<br>
<br>Jack<br><br><div class="gmail_quote">On Tue, Feb 7, 2012 at 1:26 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</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">
<br>
Jack,<br>
<br>
PetscScalar is defined in petscmath.h to be one of several things:<br>
<br>
typedef std::complex<float> PetscScalar;<br>
typedef std::complex<double> PetscScalar;<br>
typedef float complex PetscScalar;<br>
typedef double complex PetscScalar;<br>
typedef float PetscScalar;<br>
typedef double PetscScalar;<br>
typedef __float128 PetscScalar;<br>
<br>
Matt's point is that WE (the guys hacking on PETSc everyday) are not going to add other possibilities for cusp and complex at this point in time. We simply don't have the time/reason to add all this functionality now. If recursader wants that functionality he is free to hack the code and add it; if he does it in a clean way that he can provide patches then we will put the patches into petsc-dev. We simply don't have the resources to add all stuff to PETSc that anyone wants anytime and we have to focus on adding functionality that is commonly needed and will be widely used (especially within DOE).<br>
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Feb 7, 2012, at 12:10 PM, Jack Poulson wrote:<br>
<br>
> On Tue, Feb 7, 2012 at 11:29 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
> On Tue, Feb 7, 2012 at 11:20 AM, recrusader <<a href="mailto:recrusader@gmail.com">recrusader@gmail.com</a>> wrote:<br>
> Whether is it possible to find an efficient mechanism to do the conversion between std::complex and cusp::complex when the conversion is necessary.<br>
><br>
> 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<br>
> make the necessary changes, so I would say that complex numbers are not supported with our GPU code right now. The<br>
> change would involve using cusp::complex for PetscScalar, and I am not sure how much work that would entail.<br>
><br>
> Matt<br>
><br>
> Matt,<br>
><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<br>
<br>
</div></div></blockquote></div><br>