<div class="gmail_quote">On Mon, May 30, 2011 at 16:38, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You wrote the code that takes PetscInt p!!! If you do not want that, change it to PetscReal.</blockquote></div><br><div>Right, I was relying on standard promotion rules and forgot about std::pow(scalar, int). The exponent is a loop counter, so it can't reasonably be made a scalar. This whole thing could be implemented without calling pow() in any form, just multiplication, but it's not in a performance-sensitive place and I thought the code would be easier to read this way.</div>
<div><br></div><div>The reason I brought this up is that I thought it was worth standardizing a way to get an integer power (this is a common thing to need in adaptive controllers). Should we add a function like PetscPowRealInt()? This seems ugly, but it's also ugly and confusing to deal with these functions resolving to quite different things on C versus C++ builds (with the usual variability in C++ compilers). This code is over a year old so it shouldn't have new portability issues. The existence of a new ticket seems like a defect in the process, but I'm not sure what the best fix is.</div>