Re: [Rcpp-devel] Errors while compiling a script (seems to be related to Fortran)

2014-09-04 Thread Xiao He
MASS.h, and (3) making the main script file call the MASS functions by doing include "MASS.h". But the same errors were still present. Thank you again for your help! -Xiao On Wed, Sep 3, 2014 at 9:52 PM, Dirk Eddelbuettel wrote: > > Xiao, > > On 3 September 2014 a

Re: [Rcpp-devel] Errors while compiling a script (seems to be related to Fortran)

2014-09-03 Thread Xiao He
Hi Kevin, Yes, those extra includes are there because some functions taken from the MASS package need these them. I rearranged the includes by placing #include before the ones below, and was able to reduce the number of errors from 7 to 4. #include #include #include Is it possible for you t

[Rcpp-devel] Errors while compiling a script (seems to be related to Fortran)

2014-09-03 Thread Xiao He
Hi all, I tried to compile a script using the code below: Rscript compiler.R '/Users/xiaohe/WRScpp/src/test.cpp' And I got 7 error messages in total as shown below. I am on a

Re: [Rcpp-devel] error handling for computational singularity

2013-07-07 Thread Xiao He
at, Jul 6, 2013 at 9:28 PM, Dirk Eddelbuettel wrote: > > On 6 July 2013 at 18:56, Xiao He wrote: > | Hi dear listers, > | > | Take the mock function below for an example. What would be the best way > to > | handle computational singularity? > > That is essent

[Rcpp-devel] error handling for computational singularity

2013-07-06 Thread Xiao He
Hi dear listers, Take the mock function below for an example. What would be the best way to handle computational singularity? #include #include #include // [[Rcpp::depends(RcppArmadillo)]] using namespace Rcpp; using namespace arma; RcppExport SEXP foo(SEXP X, SEXP Y){ arma::mat x=Rcpp::as(

Re: [Rcpp-devel] Error when calling `qchisq()`.

2013-07-05 Thread Xiao He
which > the function qchisq is defined. > > Best > > Simon > > > On Jul 5, 2013, at 6:22 PM, Xiao He wrote: > >> Hi, >> >> I tried to call qchisq() (see mock code below). But while compiling it, I >> got an error message saying ` error: no

[Rcpp-devel] Error when calling `qchisq()`.

2013-07-05 Thread Xiao He
Hi, I tried to call qchisq() (see mock code below). But while compiling it, I got an error message saying ` error: no matching function for call to ‘qchisq(double, double, int, int)’`. I checked this file: http://dirk.eddelbuettel.com/code/rcpp/html/Rmath_8h_source.html, and saw this: " double qc

Re: [Rcpp-devel] How to use https://github.com/jjallaire/rcpp-gallery/blob/gh-pages/src/2013-01-05-r-function-from-c++.cpp?

2013-05-23 Thread Xiao He
en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] Rcpp_0.9.13 > > On Thu, May 23, 2013 at 11:27 PM, Xiao He > wrote: > > If you com

Re: [Rcpp-devel] How to use https://github.com/jjallaire/rcpp-gallery/blob/gh-pages/src/2013-01-05-r-function-from-c++.cpp?

2013-05-23 Thread Xiao He
If you compile it from within R using sourceCpp("cpp_file_name.cpp "). Or if you use the package inline, you can do the following inside R. cppFunction(' NumericVector callFunction(NumericVector x, Function f) { NumericVector res = f(x); return res; }' ) Both met

[Rcpp-devel] Use a compiled .so file that uses RcppArmadillo

2013-05-23 Thread Xiao He
Dear listers, To compile a C++ code that makes use of RcppArmadillo, one needs to have Fortran installed on the computer. After compiling the code, if I would like to use the compiled code on a computer that doesn't have Fortran, does it mean I will also need to install it on that computer? Than

Re: [Rcpp-devel] Pass a function name as an argument.

2013-05-18 Thread Xiao He
llo-pass-user-defined-function > > http://gallery.rcpp.org/articles/passing-cpp-function-pointers/ > > HTH, > > baptiste > > On 18 May 2013 19:00, Xiao He wrote: > >> Hi JJ, >> >> Thank you for the reply. I would actually like to pass C++ functions to >>

Re: [Rcpp-devel] Pass a function name as an argument.

2013-05-18 Thread Xiao He
this Rcpp Gallery article: > > http://gallery.rcpp.org/articles/r-function-from-c++/ > > J.J. > > On Sat, May 18, 2013 at 1:31 PM, Xiao He wrote: > >> Hi everyone, I have two questions regarding passing a function name as an >> argument. >> >> (1). Suppose that

[Rcpp-devel] Pass a function name as an argument.

2013-05-18 Thread Xiao He
Hi everyone, I have two questions regarding passing a function name as an argument. (1). Suppose that I have a function foo() shown below. The function takes a NumericVector and a function pointer that points to a function that takes a NumericVector and returns a double. Note that the function poi

Re: [Rcpp-devel] Segfault error during simulation in Rcpp

2013-05-16 Thread Xiao He
Hi Dirk, Does the code crash your R every time you run it or only occasionally? I ran your sample code exactly the way it's written, and my R did not crash. > myFun <- cppFunction('NumericMatrix myFun(NumericMatrix input, int n){ + NumericMatrix A(n, n); + for(int Row = 0; Row < n; Row++) { +

Re: [Rcpp-devel] Segfault error during simulation in Rcpp

2013-05-16 Thread Xiao He
I tried it just now. Did not crash on my R. Mmm myFun =cppFunction('NumericMatrix myFun(NumericMatrix input, int n){ + + NumericMatrix A(n, n); + + for(int Row = 0; Row < n; Row++) + for(int Col = 0; Col < n; Col++) + { + A(Row, Col) = input(Row, Col); + } + + return A; + }') > n = 10 >