clad
clad copied to clipboard
clad -- automatic differentiation for C/C++
Clad doesn't work with functions where is doesn't know the definition anymore. Reproducer: ```c++ // clang++ -fPIC mylib.cxx -c -o mylib.o && ar r libmylib.a mylib.o double foo(double x, double...
These changes fix the differentiation of variable declarations in for loop conditions that used to result into wrong derivatives. The commit also tackles the problem of having an assignment operator...
When differentiating ``void fn(double* &x)`` we used to get a pullback ``void fn_pullback(double* &x, double** _d_x)``, which causes crashes because in all other places ``_d_x`` is expected to be of...
The purpose of this PR is to make ``GlobalStoreAndRef`` work more consistently inside and outside of loops. The issue is well described in #431. The solution proposed in this PR...
Clad only checks the inner-most enclosing class for a non-differentiable attribute in [DerivativeBuilder::Derive](https://github.com/vgvassilev/clad/blob/1011b13bd25c4d9f685136288b2ded0919aed79c/lib/Differentiator/DerivativeBuilder.cpp#L324-L336). Example: ```cpp #define non_differentiable __attribute__((annotate("non_differentiable"))) #include "clad/Differentiator/Differentiator.h" struct non_differentiable outer { struct inner { double fn(int x,...
Clad does not handle if-condition side-effects for all cases. The below example gives incorrect derivative: ```cpp #include "clad/Differentiator/Differentiator.h" #include #define show(x) std::cout
As in #1049, the statement inside the braceless if isn't included, causing an error. To avoid that now we check if `thenDiff.getStmt_dx()` is empty, if so we create if statement...
Hi, First thanks for this great tool ! Now when trying _jacobian_ I found that I cannot use intermediate variables inside the "function". See the example below, it is a...
This commit adds primitive support of reverse-mode custom derivatives for constructors. Constructors can thought of like a special function. A function which also constructs an object. Therefore, differentiation of a...