Wednesday, 15 May 2013

c++ - RcppParallel: Converting CharacterMatrix to RMatrix<T> -


Hello dear community,

I am learning RCPPRLLL and trying to convert an RCPP The problem is:: The character matrix is ​​using the following code as RCPPRLLRL :: RMTrix:

  struct charmatist: RCPPRAL :: Worker {CONST RCPPRLL :: RMTrix and LT; STD :: string & gt; a; Const RCPPRAL :: Armatrix & lt; Std :: string & gt; B; Config numeric vector w; RcppParallel :: RMatrix & LT; Double & gt; Retired; Int n; CharMatDist (Character Matrix A, Character Matrix B, Eneric Vector Y, Numeric Matrix Rate): A (A), B (B), W (W), Write (Rate) {N = BNOO.O. ; As a gallery suggestion, I hope that A (A) etc. should be automatically adapted. But it is not working and gives me the following error:  
/ P>
  'RCPP: matrix & lt; 16 & gt; :: Ethernet (aka RCPP :: Internal :: Proxy_chter & lt; Rcpp :: Internal :: string_proxy & lt; 16 & gt; & gt;) To change 'four * initially  

I also tried

  RMatrix & lt; Char & gt;  

And even the manual cast in the body but without success too. Where am I doing wrong ??

Any suggestions and help would be highly appreciated.

YYA

The problem here is that CharacterVector And the character matrix are actually only vectors of SEXP s - in particular, a CharacterVector a STRSXP Wrapped, which has an array of content SEXP s (Runtime Type CHARSXP ) Unfortunately, it is important to know these details when interacting with RK character types.

I do not know if this will work, but if this happens, then you RMatrix & lt; Want to use something like SEXP & gt; , which will map to the built-in CHARSXP S inside the matrix (in which approximation), in which you place const char * with the string with Underline CHAR .

Unfortunately, in this case, the RMatrix class is not 'smart' to provide direct access to the built-in strings, so I believe that you open it automatically.


No comments:

Post a Comment