NLopt with Armadillo data
问题 The NLopt objective function looks like this: double myfunc(const std::vector<double> &x, std::vector<double> &grad, void *my_func_data) x is the data being optimized, grad is a vector of gradients, and my_func_data holds additional data. I am interested in supplying Armadillo matrices A and B to void *my_func_data . I fiddled with Armadillo's member functions mat A(5,5); mat B(5,5); double* A_mem = A.memptr(); double* B_mem = B.memptr(); which gives me a pointers to the matrices A and B. I