On 18 November 2016 at 19:08, Kokia Z wrote:
| I need to compute a kronecker product of two matrix, but the vector is out of
| the limit:
| 
|   Error in kronecker(X, as(Y, "TsparseMatrix"), FUN = FUN, make.dimnames =
| make.dimnames,  :
|   Error in validityMethod(as(object, superClass)) :
|   no support for long vectors�� ../include/Rinlinedfuns.h:137

That's an R function. Maybe it needs another change for x_len_t?
 
|    So I try to call a kronecker function, the corresponding file in the
| fn_kron.hpp file are:

The rest of your post is (and pardon my directness here) somewhat
uninformed.  Please look at (at least) the

   vignette on RcppAttributes to learn about sourceCpp()

   the function RcppArmadillo.package.skeleton() to understand a simple
   package

and see how the Attributes infrastructures takes C++ code (that is simpler
than what you have before) and makes it callable from R.

Dirk

 
| 1) In "R":
| Rcpparma_hello_world <- function () {
| .Call ( 'fn_kron_hpp_rcpparma_hello_world', PACKAGE = 'fn_kron.hpp')
| }}
| 
| Rcpparma_outerproduct <- function (x) {
| .Call ( 'fn_kron_hpp_rcpparma_outerproduct', PACKAGE = 'fn_kron.hpp', x)
| }}
| 
| 2) "src":
| #Include <Rcpp.h>
| Using namespace Rcpp;
| 
| // rcpparma_hello_world
| Arma :: mat rcpparma_hello_world ();
| RcppExport SEXP fn_kron_hpp_rcpparma_hello_world () {
| BEGIN_RCPP
| Rcpp :: RObject rcpp_result_gen;
| Rcpp :: RNGScope rcpp_rngScope_gen;
| Rcpp_result_gen = Rcpp :: wrap (rcpparma_hello_world ());
| Return rcpp_result_gen;
| END_RCPP
| }}
| // rcpparma_outerproduct
| Arma :: mat rcpparma_outerproduct (const arma :: colvec & x);
| RcppExport SEXP fn_kron_hpp_rcpparma_outerproduct (SEXP xSEXP) {
| BEGIN_RCPP
| Rcpp :: RObject rcpp_result_gen;
| Rcpp :: RNGScope rcpp_rngScope_gen;
| Rcpp :: traits :: input_parameter <const arma :: colvec &> :: type x (xSEXP);
| Rcpp_result_gen = Rcpp :: wrap (rcpparma_outerproduct (x));
| Return rcpp_result_gen;
| END_RCPP
| }}
| 
| 3)"man" includes rcpparma_hello_world.Rd and fn_kron.hpp-package.Rd two
| documents.
| 
| 
| # =================================================
| So now the question is that I not know how to call the function in R ?
| Library (RcppArmadillo)
| Ws <- .Call ( 'fn_kron_hpp_rcpparma_outerproduct', PACKAGE = 'fn_kron.hpp',
| listw)
| 
| Note: I used the R kronecker function, the code is as follows:
| I_T <- Diagonal (T)
| Ws <- kronecker (I_T, listw)
| 
| And I do not understand what 'x' represents in . Call (
| 'fn_kron_hpp_rcpparma_outerproduct', PACKAGE = 'fn_kron.hpp', x).
| 
| Thank you !
| 
| 
| 
|  
| 
| _______________________________________________
| 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

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
_______________________________________________
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

Reply via email to