Oops sorry, should be begin(). data() is the Eigen method. Best, Yixuan On Feb 17, 2015 6:12 PM, "Sparapani, Rodney" <rspar...@mcw.edu> wrote:
> On Tue, 2015-02-17 at 15:57 -0500, Yixuan Qiu wrote: > > Hello Rodney, > > > > If all you need is to pass a pointer to the fit() function (assuming > > fit() does not modify x) and get the result a, you do not need to make > > a copy. Simply wrap _x by a NumericVector and call the data() method. > > > > Rcpp::NumericVector x(_x); > > > > double a = fit(x.data(), n); > > > > You can even directly use the R API without creating an Rcpp object. > > > > double a = fit(REAL(_x), n); > > > > > > Best, > > > > Yixuan > > Hi Yixuan: > > That's exactly what I wanted! However, I can't seem to find that method > at http://dirk.eddelbuettel.com/code/rcpp/html > > Can you please point me to it? > > From this... > > Rcpp::NumericVector x(_x); > > double a = fit(x.data(), n); > > I get... > > error: class Rcpp::NumericVector has no member named data > > Am I doing something dumb? > > I'm using Rcpp 0.10.3 w/ 2.15.3 R and GCC 4.4.7 if it matters. > > Thanks, > > Rodney > >
_______________________________________________ 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