c++ - how to use string variable in RcppEigen -


I'm new to RCPP and RQPegen. If this question is naive then apologize. "Eigen :: MatrixXd; using the Eigen :: map; constants map & lt; MatrixXd & gt;; here the code is compiled in R.,

  is required ( RcppEigen is required (inline) body & lt (as & lt; map & lt; matrixxd> gt; & gt; (x 0); constant map & lt; matrixxd & gt; y (& lt In the form, the map is & gt; MatrixXd & gt; & gt; (Y0)); Integer N = X.rows (); Integer P = X.cols (); ET NY = Vicol (); Matrix Add I , N); ISET IDT (N, N); Double SSE = ( Y. Transges (* * * Ix * (X. Transws) * X) * X (transitions) * Y) Return Op (N * Log (SSE / N) + Log (N) * P) ; "IC & Lt; - Sifaksfnkshn (sign (x 0 = "matrix", Y0 = "Matrix"), body, plugin = "Arseepiiijen") IC (x 1, y)  

where X and Y respectively Are,

  X1 < - Matrix (c (1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0 , 2,0,1,0,2,0,1,0,2,0,1,0,2,0,1, 0,2,0,1,0,0,3,1, 0,0 , 3,1,0,0,3,1,0,0,3,1,0,0,3,1,0,0,3,1,0,0,3,1,0, 0,3 , 1,0, 0,3,1,0,0,3,01), 20.4, Bio = True) Y & LT; - Matrix (c (50,51,52,54,3,360,59,65,67,70,70,73,74,78,82,80,87,84,88,92), 20,1)  

I can run the code above successfully. But now I need to add some string variables and double numeric

  RcppEigen) is required (RCPP) (Inline) body & lt; - "// # include  using Eigen :: Map; Eugene :: Metrics Xd; using RCPP as :: Const Map  X (As & Lt; Map & lt; MatrixXd & gt; & gt; (x);); Const Map  Y (as in & lt; Map & lt; MatrixXd & gt; & gt; (Y0) ); String criteria = RCPP :: as in & lt; String> (Criterion 0); Double Sigma = RCPP :: as & lt; Double & gt; (sigma 0); Int n = X.rows (); Int p = X.cols (); Int nY = Y.cols (); Matrix Xd I (n, n); I.setIdentity (N, N); Double SSE = (Y. Transges (*) I * (X. Transzze (x) * x) * Exchanges * * X Transpos ()) * Y). Determinant; if (criteria == 'A1') {return rape (n * log (sse / N) + Log (n) * P);} If (criteria == 'A2') {return wrap (n * log (sse / n) + (2 * p * ny * n + ny * (ni + 1 }} / N -2 / N + N + 2;} If (criteria == 'A3') {return wrap (n * log (sse / n) + 2 * (2 + p) * (n * sigma) / SSE) -2 * (n * sigma / sse) * (n * sigma / sse)); } "IC & lt; - cxxfunction (sign (X 0 =" matrix ", Y0 =" matrix ", Criteria0 =" String ", Sigma0 =" numeric "), body, plugin =" RcppEigen ") IC (X1, Y , "A2", 0)  

but an error occurs.

  Error in compileCode (f, code, language = language, verbose = Verbose): compilation ERROR, created not function (s) / method (s)! Saigvin Warning: MS-DOS style detected path: C: / R / R -31 / 1/1 / ATC / X64 / Mekpaks favorite POSIX Is equivalent: / cygdrive / c / R / R-31 ~ 1.1/etc/x64/Makeconf CYGWIN environment variable option "nodosfilewarning" This warning closes: For more information about POSIX pathways, consult the user guide: http://cygwin.com/cygwin-ug-net/using .html # using-pathnames filec2c6da05e50.cpp: 48 : 14: Warning: multi-character character constant [-Wmultichar] filec2c6da05e50.cpp: 51: 14: Warning: multi-character character constant [-Wmultichar] filec2c6da05e50.cpp: 54: 14: Warning: multi-character character constant [-vilticr] File Included in C: / User / LJH / Document / R / Win-Lib Rary / 3.1 / RcppEigen / Include / Eigen / C T: 305: 0, C: /Users/LJH/Documents/R/win-library/3.1/RcppEigen/include/Eigen/Dense: 1, C: / Users / Eljiac / documents / R / win-library / 3.1 / Arseepiiijen / include / Arseepiiiginforward H: 30, C: / u addition: Warning message: running the command "C: / R / R -31 ~ 1.1 / Bean / X64 / R CMD SHLIB filec2c6da05e50.cpp 2 & gt ; Filec2c6da05e50.cpp.err.txt 'status1 & gt; & Gt; IC (X1, Y, "A2", 0) Error: The function "IC" could not be found  

Any help would be appreciated.

"post-text" itemprop = "text">

Make these changes:

  1. Std :: string; and

  2. use criteria == "A1" (i.e. double equal and double quotation marks and body wire Insert single quotes around so that double quotes can be used inside it.)


Comments

Popular posts from this blog

Active Directory Authenticated Proxy Server with Squid or CNTLM -

java - @PluginTarget(Node.class) not registering as neo4j plugin -

python - Calculate STD manually using Groupby Pandas DataFrame -