From spindler at mea.mpisoc.mpg.de  Tue Sep 30 13:00:37 2014
From: spindler at mea.mpisoc.mpg.de (Martin Spindler)
Date: Tue, 30 Sep 2014 13:00:37 +0200
Subject: [Rd] Package Rcpp: Question conerning source code of cpp files and
 related question
In-Reply-To: <trinity-5f1e01aa-b4d7-45e3-b269-f071d5626ece-1412074654721@3capp-gmx-bs52>
References: <trinity-5f1e01aa-b4d7-45e3-b269-f071d5626ece-1412074654721@3capp-gmx-bs52>
Message-ID: <542A8D55.2070700@mea.mpisoc.mpg.de>

Dear all,
I am trying to use Rcpp to write some files in C++ for use in R.
Below is an example for a cpp-file (crossp.cpp). Then I use 
 >sourceCpp("crossp.cpp") in R and the corresponding function is 
availabe in R.
Now I have to question related to this worklfow:
1) Is there a way to see the source file of the "final" cpp-file? (I 
mean is it possible to see how the //-lines are replaced and what 
soureCpp does?)
2) (Connected with the first question) Up to now, I am working in R 
Studio, but I would  prefer an IDE (e.g. NetBeans IDE). But when I 
compile the cpp-file there,  the following message shows up:
In file included from 
/R/win-library/3.0/RcppArmadillo/include/RcppArmadilloForward.h:28:0,
                  from 
/R/win-library/3.0/RcppArmadillo/include/RcppArmadillo.h:30,
                  from crossp.cpp:1:
/R/win-library/3.0/RcppArmadillo/include/RcppArmadilloConfig.h:90:35: 
fatal error: RcppArmadilloLapack.h: No such file or directory
    #include <RcppArmadilloLapack.h>
Is there an way to compile the file without sourCpp but in an IDE? What 
do I have to change?
As I am starting to work with Rcpp my question might sound silly, but 
any help and comments are highly welcome.
Thank you very much for your help in advance!
Best,
Martin
crossp.cpp:
#include <RcppArmadillo.h>
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
using namespace arma;
//[[Rcpp::export]]
NumericMatrix crossp3(NumericMatrix Xr) {
   int n = Xr.nrow(), k = Xr.ncol();
   arma::mat X(Xr.begin(), n, k, false);
   arma::mat XXt = X.t()*X;
   return Rcpp::wrap(XXt);
}


	[[alternative HTML version deleted]]



[Rd] Package Rcpp: Question conerning source code of cpp files and related question
Martin Spindler