On Tue, Feb 7, 2012 at 3:46 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div><div class="gmail_quote">On Wed, Feb 8, 2012 at 00:43, Jack Poulson <span dir="ltr"><<a href="mailto:jack.poulson@gmail.com" target="_blank">jack.poulson@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">
Good to know; I didn't know libquadmath provided that. The catch is that it does not allow one to easily extend templates that previously handled 32-bit and 64-bit base types. On the other hand, a custom complex class could easily just call the built-in functions for __complex128 when instantiated with a base type of __float128. </blockquote>
</div><br></div><div>It'll work fine with PETSc's typedef of PetscReal and PetscScalar. I never like that C++ crap anyway. ;-D</div><div><br></div><div>(You could template over the real and complex types separately, but I guess you are assuming a certain syntax for converting between reals and complex.)</div>
</div></blockquote><div><br>Yes, one could argue that PetscScalar can behave like a custom complex class, but with only a single instantiation choice through the preprocessor where each implementation was completely separate. If this type of logic was pulled into the language instead of lying at the preprocessor stage, then it would result in a custom complex class like I am arguing for. Either way std::complex is not being used for quads. <br>
<br>Any way, it sounds like the current approach will work just fine for PETSc, so I will shut up. The only other argument would be if someone wanted to compute using some exotic datatype like the Gaussian integers, but that would require a subset of the functionality of standard complex class that only assumed a ring instead of a field.<br>
<br>Jack<br></div></div>