I am using nonlinear least square routine as shown in Reference Manual Chapter 14. And I follow the example "ex_nlsqp_c.c".
The routine "djacobi" in Line 206 calls a fcn which should be the user defined objective function. And this fcn takes 4 inputs: m, n, x, f, where output is f=f(x). What if I want to pass an extra array double *T into this fcn,just like the Matlab function ”lsqnonlin“ does? My fcn value is defined as f=(T*x)^2, where the T is huge and need only to be calculated somewhere else only once.
Although I can always calculate the T matrix inside my fcn each time when fcn is called., it is time-consuming and not necessary to do so.
Operating System: Windows OS