Closed eweca-d closed 3 months ago
Hi, can you provide a self-contained example so I can reproduce the error? It was my understanding that jacobian
should not have any problem accepting a vector of closures.
My bad. Just find I did not remember to annotate like func: Vec<&dyn Fn(&[f64; M]) -> f64> = vec![];
. Thank you for your great job again!
No problem. Glad it all worked out. Closing the issue as resolved. @eweca-d btw, from your comment it looks like you're using an older version of this crate. The API recently changed to get rid of vectors entirely, to better support no-std environments and no heap allocations. If you choose to update multicalc
, the annotation must be changed to func: [&dyn Fn(&[f64; M]) -> f64; N]
, where M
is number of variables and N
is number of closures in the function_matrix
. You can refer to the example code here: https://github.com/kmolan/multicalc-rust/blob/main/src/numerical_derivative/test.rs#L653
Thank you for doing this great job!
I am trying to make use of this crate to generate jacobian matrix for curve fitting of arbitrary functions with crate
levenberg-marquardt
. Therefore, I need to derive jacobian matrix based on the generated closures that capture input xdata in runtime. Do you have any plan to support closure as the element offunction_matrix
in the module ofJacabian
?