Hello,<div><br></div><div>I have a quick design question. I am working on a program that uses RInside and RcppEigen, and I want to expose a function back to R. Specifically, I have a C++ function with the following signature:</div>

<div><br></div><div><div>double nll_singleton(</div><div><span class="Apple-tab-span" style="white-space:pre">              </span>     const VectorXd& theta,</div><div><span class="Apple-tab-span" style="white-space:pre">            </span>     const MatrixXd& ua,</div>

<div><span class="Apple-tab-span" style="white-space:pre">              </span>     const MatrixXd& ub,</div><div><span class="Apple-tab-span" style="white-space:pre">               </span>     const MatrixXd& Xmat,</div><div><span class="Apple-tab-span" style="white-space:pre">             </span>     const MatrixXd& Ymat);</div>

</div><div><br></div><div>I would like to run R's optim over this function, where 'theta' is the vector that I am optimizing over. Would I use RCpp::InternalFunction for this? nll_singleton is going to call MPI and I would rather do it this way than use mpi over R, if this is possible.</div>

<div><br></div><div>Thank you and best regards,</div><div>Stephen</div>