clad icon indicating copy to clipboard operation
clad copied to clipboard

Position of output parameter in gradient calls

Open efremale opened this issue 6 years ago • 0 comments

Now we pass the output _result array to gradient functions as a last parameter. This causes some problems, e.g., default parameter values cannot be used as the _result parameter is last and has no default value. This leads to generation of functions like

void f_grad(double x, double y = default_y, double* _result);

where there is no way to actually call it with default_y value.

Some problems may also arise when f or f_grad is declared as variadic template function.

Are there better solutions? Does it make sense to pass _result as a first parameter?

efremale avatar Jul 07 '18 22:07 efremale