vgvassilev / clad

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

Clad breaks when using some `std::vector` constructors in the reverse mode #1067

Open gojakuch opened 3 weeks ago

gojakuch commented 3 weeks ago

reproducer:

#include "clad/Differentiator/Differentiator.h"
#include "clad/Differentiator/STLBuiltins.h"
#include <iostream>
#include <vector>

#define show(x) std::cout << #x << ": " << x << "\n";

double fn(double u, double v) {
    std::vector<double> vec(3);
    return 0;
}

int main() {
    auto d_fn = clad::gradient(fn);
    double u = 3, v = 5;
    double du, dv;
    du = dv = 0;
    show(fn(u, v));
    d_fn.execute(u, v, &du, &dv);
    show(du);
    show(dv);
}
SreeSharvesh commented 3 weeks ago

Hi! I would like to solve this issue...Can you assign it to me??

vgvassilev commented 3 weeks ago

Hi! I would like to solve this issue...Can you assign it to me??

Please submit a pull request.

gojakuch commented 2 weeks ago

Hi! I would like to solve this issue...Can you assign it to me??

Hi @SreeSharvesh, as Vassil has said just submit a pull request solving this issue and mark it appropriately as described here. feel free to ask any questions about the issue here.