I apologize if I am not being clear. I realize that R doesn't have float
data types, however I am able to pass a matrix in as a MatrixXf object. I
would like to be able to refer to this MatrixXf object persistently. Some
general code to demonstrate my point.
# pass R matrix in as MatrixXf object and return pointer to that object
SEXP matrixIN(MatrixXf A)
{
return XPtr<MatrixXf>(A);
}
# pass previously made pointer and return that matrix
SEXP matrixOUT(XPtr<MatrixXfr> ptrA)
{
MatrixXf A = *ptrA
return wrap(A)
}
On Fri, Jun 26, 2015 at 8:32 AM, Dirk Eddelbuettel <[email protected]> wrote:
>
> On 26 June 2015 at 07:43, Charles Determan wrote:
> | I have tried a few more feeble attempts (explicitly create pointer to
> pass,
> | passing just the MatrixXf object) at getting the Eigen object to persist
> | between functions without the additional Armadillo wrapper but with no
> | success. Anyone have any additional thoughts?
>
> You are not making it very easy to help you as you do not clearly say what
> you really want. Some things you talk about don't exist (ie "float matrix
> in
> R"), others make no sense (XPtr of Eigen::Map when the latter already is a
> proxy object).
>
> As for the question of persistence, the single simplest approach I often
> use
> it create a trivial class holding a member variable of the "thing" you want
> to persist (often a database or resource handle, could even be a honking
> bigmemory object and shared handle) whichI create in the constructor, or an
> init() function, and release in the destructor.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | [email protected]
>
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel