- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
Thanks
Dazhao
Operating System: Windows OS
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If T is initialized once and reused many times without any changes, why not make it global in scope and use it in the function as needed, instead of trying to pass it as yet another function argument?
Since the MKL solver calls your user-defined function with a fixed and pre-defined argument list, you cannot add items to the argument list.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page