You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In cminpack, two types of function pointer are used. For example, as for hybrd, we could pass a function pointer to it, which is like void(*fun)(const int *n, const real *x, real *fvec, int *iflag) or int (*fun)(void *p, int n, const real *x, real *fvec, int iflag). The void *p in the latter type is used to pass additional parameters without using global variables.
But if we want to use lambda, functor, or something else, we cannot make it. So, why not use some templates, so that we are not only able to pass a static type function pointer to hybrd, but also lambda, functor or other stuff.
The text was updated successfully, but these errors were encountered:
The underlying code is C, and I'm not sure how to call a lambda from C. This goes beyond my C++expertise. If you find a way to make it work without breaking the C API, please submit a PR
In cminpack, two types of function pointer are used. For example, as for
hybrd
, we could pass a function pointer to it, which is likevoid(*fun)(const int *n, const real *x, real *fvec, int *iflag)
orint (*fun)(void *p, int n, const real *x, real *fvec, int iflag)
. Thevoid *p
in the latter type is used to pass additional parameters without using global variables.But if we want to use lambda, functor, or something else, we cannot make it. So, why not use some templates, so that we are not only able to pass a static type function pointer to
hybrd
, but also lambda, functor or other stuff.The text was updated successfully, but these errors were encountered: