vgvassilev / clad

clad -- automatic differentiation for C/C++
GNU Lesser General Public License v3.0
266 stars 113 forks source link

Add support for pointers in TBR analysis. #691

Open vaithak opened 6 months ago

vaithak commented 6 months ago

We have recently added pointer support in reverse mode (#686), but the tests are currently failing when trying to run with the enable-tbr flag. The test file is test/Gadient/Pointers.C.

vaithak commented 5 months ago

One example which fails in current TBR analysis:

double pointerParam(const double* arr, size_t n) {
  double sum = 0;
  for (size_t i=0; i < n; ++i) {
    size_t* j = &i;
    sum += arr[0] * (*j);
    arr = arr + 1;
  }
  return sum;
}