Displaying 1 result from an estimated 1 matches for "opt_result".
Did you mean:
opt_results
2020 Oct 15
0
calling stats::optim from Rcpp causes memory leak
...obj = .666 - x;
return pow(obj, 2);
}
// [[Rcpp::export(leak)]]
double leak(double a, double b){
// Extract R's optim function
Rcpp::Environment stats("package:stats");
Rcpp::Function optim = stats["optim"];
// Call the optim function from R in C++
Rcpp::List opt_results = optim(Rcpp::_["par"] = .5,
Rcpp::_["fn"] =
Rcpp::InternalFunction(&objective_function),
Rcpp::_["method"] = "Brent",
Rcpp::_["lower"] =...