<p>ScalarComplex was just a typo that I noticed shortly after sending.</p>
<p>As for LogScalar versus ScalarLog, I can change it, but it's kind of intrusive to users and I'm not convinced it matters.</p>
<div class="gmail_quote">On Sep 10, 2012 6:37 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   Are these names correct?<br>
<br>
<br>
  #define PetscPowScalarComplex(a,b)   complexlib::pow(a,b)<br>
+#define PetscExpScalarComplex(a)     complexlib::exp(a)<br>
+#define PetscLogScalarComplex(a)     complexlib::log(a)<br>
<br>
    Generally in PETSc when we have a function specific to a subclass (say GMRES subclass of KSP) we use for example KSPGMRESSetRestart() NOT KSPSetRestartGMRES().<br>
<br>
    And why is there a Scalar AND a Complex in the name?<br>
<br>
     Why not have<br>
<br>
        PetscRealLog( PetscReal x, …<br>
        PetscComplexLog( PetscComplex x,…<br>
        PetscScalarLog( PetscScalar x,….                     is always one of the two above depending on the PetscScalar type at ./configure time<br>
<br>
    Barry<br>
<br>
<br>
<br>
On Sep 10, 2012, at 11:19 AM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>> wrote:<br>
<br>
> I would like to use complex arithmetic in some code that does polynomial optimization in the complex plane (for adaptive smoothers), even when PetscScalar is real. I'd like to push something like the attached, but since this is potentially fragile, I'm posting here before pushing. Any objections to my pushing?<br>

><br>
> This works with my C and C++ real builds as well as C and C++ complex. I also tried a real build that disabled PETSC_HAVE_C99_COMPLEX (because all my compilers support it), but of course that's not much of a check.<br>

><br>
> One thing that I think we could support (because C99 and C++ complex is binary compatible) is choosing the complex implementation based on the current language rather than PETSC_CLANGUAGE.<br>
> <complex.diff><br>
<br>
</blockquote></div>