Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for std containers for the rangebased for loops #1004

Open
ovdiiuv opened this issue Jul 24, 2024 · 0 comments
Open

Add support for std containers for the rangebased for loops #1004

ovdiiuv opened this issue Jul 24, 2024 · 0 comments

Comments

@ovdiiuv
Copy link
Collaborator

ovdiiuv commented Jul 24, 2024

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

double f(double x){
  double sum = 0;
  std::vector<double> a = {1, 2, 3};
  for(auto& i: a){
    sum+=i*x;
  }
  return sum;
}

int main(){
  auto fdx = clad::gradient(f);
  return 0;
}

results in

warning: attempted to differentiate unsupported statement, no changes applied
  std::vector<double> a = {1, 2, 3};
                          ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant