Very good, static_cast should then do it!

Best 

Simon


On Feb 3, 2013, at 6:26 PM, Yan Zhou <zhou...@me.com> wrote:

> Yes, of course.
> 
> 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 *.
> 
> Best,
> 
> Yan Zhou
> 
> On Feb 03, 2013, at 05:13 PM, Simon Zehnder <szehn...@uni-bonn.de> wrote:
> 
>> 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? 
>> That would be the easiest way to do it.
>> 
>> Best
>> 
>> Simon
>> On Feb 3, 2013, at 5:45 PM, Yan Zhou <zhou...@me.com> wrote:
>> 
>> > 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.
>> > 
>> > Best,
>> > 
>> > Yan
>> > 
>> > On Feb 3, 2013, at 4:35 PM, Simon Zehnder <szehn...@uni-bonn.de> wrote:
>> > 
>> >> Hi Yan,
>> >> 
>> >> do you know if one can also write a C++ objective function in NLOpt, that 
>> >> works with Armadillo Objects? 
>> >> 
>> >> Best
>> >> 
>> >> Simon
>> >> 
>> >> On Feb 3, 2013, at 12:50 PM, Yan Zhou <zhou...@me.com> wrote:
>> >> 
>> >>> I good numerical optimization library I used before is NLOpt, for 
>> >>> non-linear optimization. http://ab-initio.mit.edu/wiki/index.php/NLopt
>> >>> 
>> >>> 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.
>> >>> 
>> >>> Best,
>> >>> 
>> >>> Yan
>> >>> 
>> >>> On Feb 3, 2013, at 11:47 AM, Simon Zehnder <szehn...@uni-bonn.de> wrote:
>> >>> 
>> >>>> Hi fellows,
>> >>>> 
>> >>>> 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. 
>> >>>> 
>> >>>> Now my question: What numerical optimization libraries in C++ do you 
>> >>>> use, when working with RcppArmadillo? It should be fast! 
>> >>>> 
>> >>>> 
>> >>>> Best
>> >>>> 
>> >>>> Simon
>> >>>> 
>> >>>> 
>> >>>> _______________________________________________
>> >>>> Rcpp-devel mailing list
>> >>>> Rcpp-devel@lists.r-forge.r-project.org
>> >>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>> >>> 
>> >> 
>> 

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to