Open MolettoLobos opened 2 years ago
One approach is
@njit
def objective_1(u, arr_len, arr):
# ...
return yvec
def make_minpack_func(arr_len, arr):
@cfunc(minpack_sig)
def objective(u_, fvec, args):
# convert u_ to numpy array
fvec_1 = objective_1(u, arr_len, arr)
# load fvec_1 into fvec
return objective
Problem with this approach is that the objective will need to be re-compiled every time you change arr
, and arr_len
. There are other workarounds that are more compilcated
Interesting question, because I thought NumbaMinpack's lmdif and hybrd were about solving and root finding. Does this mean that with NumbaMinpack you can also do least squares fitting from within a njit compiled function, similar to a call to a routine from LEVMAR, e.g. slevmar_dif?
I use this function for do a fitting in numba
However, when i cannot change the value of array shape because i cannot add a fourth argument into the nb.cfunc. How can i add the array shape inside of function?
Regards,