<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Very good, static_cast should then do it!<div><br></div><div>Best </div><div><br></div><div>Simon</div><div><br></div><div><br><div><div>On Feb 3, 2013, at 6:26 PM, Yan Zhou <<a href="mailto:zhouyan@me.com">zhouyan@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Yes, of course.</div><div><br></div><div>I was thinking about the situation where NLOpt pass the parameter and (possible) gradient vector through pointers and you need to use Armadillo on these vectors. But if all you need is to pass a matrix as the function data, in principle you can pass almost anything through void *.</div><div><br></div><div>Best,</div><div><br></div><div>Yan Zhou<br><br>On Feb 03, 2013, at 05:13 PM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch">Mmmmmh, I just think about the function data: It is pointed to via void*. That should give me the possibility to directly point to a arma::mat, right? <br> That would be the easiest way to do it.<br> <br> Best<br> <br> Simon<br> On Feb 3, 2013, at 5:45 PM, Yan Zhou <<a href="mailto:zhouyan@me.com" data-mce-href="mailto:zhouyan@me.com">zhouyan@me.com</a>> wrote:<br> <br> > I believe the answer is no. But most Arma object provide memptr to get the raw pointer which you can pass through nlopt interface. Inside the objective function you can create Arma object using auxiliary pointer. AFAIK, for const double * argument you can only creat Arma object by copy while for double * you can creat object that use the pointer directly. After this step you can use armadillo inside and outside the objective function.<br> > <br> > Best,<br> > <br> > Yan<br> > <br> > On Feb 3, 2013, at 4:35 PM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de" data-mce-href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br> > <br> >> Hi Yan,<br> >> <br> >> do you know if one can also write a C++ objective function in NLOpt, that works with Armadillo Objects? <br> >> <br> >> Best<br> >> <br> >> Simon<br> >> <br> >> On Feb 3, 2013, at 12:50 PM, Yan Zhou <<a href="mailto:zhouyan@me.com" data-mce-href="mailto:zhouyan@me.com">zhouyan@me.com</a>> wrote:<br> >> <br> >>> I good numerical optimization library I used before is NLOpt, for non-linear optimization. <a href="http://ab-initio.mit.edu/wiki/index.php/NLopt" data-mce-href="http://ab-initio.mit.edu/wiki/index.php/NLopt">http://ab-initio.mit.edu/wiki/index.php/NLopt</a><br> >>> <br> >>> You can use it just like and C/C++ library in your own code or you can use its own R interface as an R package.<br> >>> <br> >>> Best,<br> >>> <br> >>> Yan<br> >>> <br> >>> On Feb 3, 2013, at 11:47 AM, Simon Zehnder <<a href="mailto:szehnder@uni-bonn.de" data-mce-href="mailto:szehnder@uni-bonn.de">szehnder@uni-bonn.de</a>> wrote:<br> >>> <br> >>>> Hi fellows,<br> >>>> <br> >>>> I am using the RcppArmadillo package and I need in C++ some optimization methods. Before I used always the Scythe Statistical Library which had both: linear algebra and optimization methods. Armadillo has only linear algebra support. <br> >>>> <br> >>>> Now my question: What numerical optimization libraries in C++ do you use, when working with RcppArmadillo? It should be fast! <br> >>>> <br> >>>> <br> >>>> Best<br> >>>> <br> >>>> Simon<br> >>>> <br> >>>> <br> >>>> _______________________________________________<br> >>>> Rcpp-devel mailing list<br> >>>> <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" data-mce-href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br> >>>> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" data-mce-href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br> >>> <br> >> <br> <br></div></div></blockquote></div></blockquote></div><br></div></body></html>