Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

pow function in autodiff

More
4 years 8 months ago #1727 by armandyam
Hello,

I have a C++ code where I use the autodiff variables available within NGSolve. In a particular part of the code, I have an autodiff variable that has to be raised to the power of a double. Like:

f = pow(a, b)
with a = Autodiff type
b = SCAL

Looking at the autodiff.hpp I see that this is not implemented somehow. Instead, I have only autodiff raised to autodiff.


I tried exp(b*log(a)) in where the * is implemented for SCAL * Autodiff but I think the issue seems to be that sometimes I have the variable 'a' to be zero in my code and the exception handling is somehow off in the log function.

Can you suggest an alternative or can this be added easily?
Time to create page: 0.147 seconds