diff --git a/README.md b/README.md index 4410c8601..6ac136f97 100644 --- a/README.md +++ b/README.md @@ -337,12 +337,12 @@ namespace custom_derivatives { double my_pow_darg1(dobule x, double y) { return my_pow(x, y) * std::log(x); } } ``` -You can also specify a custom gradient: +You can also specify a custom pullback: ```cpp namespace custom_derivatives { - void my_pow_grad(double x, double y, array_ref _d_x, array_ref _d_y) { + void my_pow_pullback(double x, double y, double _d_y0, double *_d_x, double *_d_y) { double t = my_pow(x, y - 1); - *_d_x = y * t; + *_d_x = y * t * _d_y0; *_d_y = x * t * std::log(x); } } diff --git a/demos/ErrorEstimation/CustomModel/README.md b/demos/ErrorEstimation/CustomModel/README.md index 95cdabaac..d38e88065 100644 --- a/demos/ErrorEstimation/CustomModel/README.md +++ b/demos/ErrorEstimation/CustomModel/README.md @@ -42,13 +42,13 @@ clang++ -Xclang -add-plugin -Xclang clad -Xclang -load -Xclang CLAD_INST/lib/cla To verify your results, you can build the dummy `test.cpp` file with the commands shown above. Once you compile and run the test file correctly, you will notice the generated code is as follows: ```cpp -The code is: void func_grad(float x, float y, float *_d_x, float *_d_y, double *_final_error) { +The code is: void func_pullback(float x, float y, float _d_y0, float *_d_x, float *_d_y, double *_final_error) { float _d_z = 0; float _t0; float z; _t0 = z; z = x + y; - _d_z += 1; + _d_z += _d_y0; { *_final_error += _d_z * z; z = _t0; diff --git a/demos/ErrorEstimation/PrintModel/README.md b/demos/ErrorEstimation/PrintModel/README.md index 7b124977c..fc29a75e3 100644 --- a/demos/ErrorEstimation/PrintModel/README.md +++ b/demos/ErrorEstimation/PrintModel/README.md @@ -41,13 +41,13 @@ clang++ -Xclang -add-plugin -Xclang clad -Xclang -load -Xclang CLAD_INST/lib/cla To verify your results, you can build the dummy `test.cpp` file with the commands shown above. Once you compile and run the test file correctly, you will notice the generated code is as follows: ```cpp -The code is: void func_grad(float x, float y, float *_d_x, float *_d_y, double *_final_error) { +The code is: void func_pullback(float x, float y, float _d_y0, float *_d_x, float *_d_y, double *_final_error) { float _d_z = 0; float _t0; float z; _t0 = z; z = x + y; - _d_z += 1; + _d_z += _d_y0; { *_final_error += _d_z * z; z = _t0;