Open Optiuse opened 3 years ago
Hi, I guess there's no placeholder into FitFunc for this (if I understand the issue correctly), what's wrong with using a global variable/pointer ?
Hi, because i want to run several different optimizations at the same time in several threads. The FitFunctions need access to identifiable individual data each from its thread. Therefore a global variable/pointer is not possible because the fit functions will not get access to individual data.
Maybe something like a void pointer would be good to pass individual pointers to the FitFunc or other solution? FitFunc fsphere = [](const double x, const int N, void ptr_Data) Something like this or a placeholder to pass data would be great.
Seems like a design issue for your application. You can modify FitFunc as needed I guess. If this proves useful somehow, you may provide a pull request once tested.
Function binding provides the solution to this.
Hi, is it possible to pass own data (by reference) from scope of upper_function directly to the FitFunc? (directly from function to FitFunc, without use of global variables)