clad
clad copied to clipboard
Same variable redefinition in gradient when different loops have the same counter variable name
Gradient function contains variable redefinition error when different loops have the same counter variable name.
Reproducible example:
#include "clad/Differentiator/Differentiator.h"
double fn(double u, double v) {
double res = 0;
for (int i = 0; i < 5; ++i) {
res += i;
}
for (int i = 0; i < 5; ++i) {
res += i;
}
return res;
}
int main() {
auto fn_grad = clad::gradient(fn);
}
_d_i
is defined two times in the gradient function fn_grad
.
Hii! I would like to work on this issue. KIndly assign it to me.
Hi @muskangupta-02, Please feel free to raise a pull-request for this issue.