Dirk forwarded a posting on Google's blog about the Ceres nonlinear least squares solver in C++ to his Google+ followers and asked if anyone was interested in using Rcpp to link to this C++ code. As a person with some experience in nonlinear least squares and also having experience with Eigen (http://eigen.tuxfamily.org) which is used by Ceres, I decided to take a look.
There are many nice features of Ceres including great flexibility and both numeric and automatic differentiation. However, like many optimization codes it does not allow reverse communications, which would make for much easier integration with languages like R. Features like automatic differentiation require that the function for evaluating residuals be written in pure C++ (i.e. evaluation of an R expression would not be allowed) so that operators and functions can be overloaded. A person has already asked about this on the ceres-solver Google group - in his case he was interested in defining the residual function in python. So it may be worthwhile doing the linkage but the real advantages of the code will probably be lost. As a first cut it would probably be best to use only the dense solvers, which are based on Eigen, and not the sparse solvers based on SuiteSparse as used in the Matrix package. Eigen is a template library implemented as header files. Suitesparse is C code with a peculiar, idiosyncratic template mechanism based on Makefiles and accessing the compiled code is not fun. _______________________________________________ Rcpp-devel mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
