Questions tagged [rcpparmadillo]

204 questions
0
votes
0 answers

Any R package using superlu can be installed in Windows

Rcpp and RcppArmadillo are useful for R package development. As for RcppArmadillo, it seems superlu is the only method to utilize the sparse property for very large matrices. However, it is not clear how to let an R package with superlu work in…
Wenjian Bi
  • 11
  • 3
0
votes
0 answers

renewalCount() function in countr package in R

I am trying to use renewalCount() function in R to get the fitted model of Weibull Distribution. Here is my piece of code: wei <- renewalCount(formula = packets ~ 1, data = dfdata, dist =…
0
votes
0 answers

Can't replicate an error in CRAN solaris machine

I have a package on CRAN called 'metapack' and received a message from Professor Ripley that the error must be resolved for the package to be safely retained in CRAN. I've encountered this error on R-CMD-check on GitHub but cannot replicate it on…
Daeyoung
  • 194
  • 7
0
votes
0 answers

Rcpp support for multiple variable types

Is there a way to write an Rcpp function that can receive a variable as one of two/several datatypes, and then does something different depending on the datatype? In R this is something we hardly think about -- pass the variable in, check the…
zdebruine
  • 3,687
  • 6
  • 31
  • 50
0
votes
1 answer

Rcpp functions cause crash in package

I have a package, https://github.com/tfrostig/RSEE, which includes a few (3) RcppArmadillo functions. The package works well on other computer. When I build the package no errors appear, but whenever I call any of the RCPP functions it causes R to…
Kozolovska
  • 1,090
  • 6
  • 14
0
votes
0 answers

RcppParallel using References in workers

I have been experiment with using references for speed improvements. The (not working) trivial example below, probably won't see any improvements. However, I think by not copying the data into a separate (cost) function, should save some time for a…
skatz
  • 115
  • 7
0
votes
1 answer

How to element-wise divide 2 sparse matrices in Armadillo?

I am new to C++ but I am working with R and RcppArmadillo and my goal is to divide element-wise 2 sparse matrices. I have read in the documentation of Armadillo that the operator is / but when I source my code with sourceCpp I am getting this…
AndreasNearchou
  • 128
  • 1
  • 6
0
votes
1 answer

Getting NaN when using R::runif in Rcpp

To generate standard uniform random numbers with Rcpp, I always used Rcpp::runif(1, 0, 1)[0] The [0] is due to Rcpp::runif returning vectors. I recently found that you can also use the R API and use R::runif() instead if you only want a scalar so I…
user-2147482565
  • 453
  • 7
  • 16
0
votes
1 answer

Compare vector to double in rcpp armadillo

Consider this Rcpp Armadillo function: // [[Rcpp::depends(RcppArmadillo)]] #include using namespace arma; // [[Rcpp::export]] vec testfun(const vec &x, const double &y, const double &z) { vec out = ((y…
BerriJ
  • 913
  • 7
  • 18
0
votes
1 answer

NULL value passed as symbol address with Rcpp functions

I apologize if this question is quite silly as I am new to Rcpp. I have built a package from Rcpp but when I installed it, I found all functions related to Rcpp will return the following type of error message: Error in .Call(, M) :…
0
votes
0 answers

Fast cosine similarity of two sparse matrices in Rcpp with Armadillo

I'm trying to port a very fast R function for calculating cosine similarity into Rcpp with Armadillo and sparse matrix operations. Here's the R function: #' Compute cosine similarities between columns in x and y #' #' @description adapted from…
zdebruine
  • 3,687
  • 6
  • 31
  • 50
0
votes
1 answer

Why is my Rcpp mean function slower than R?

I want to create a C++ function that raises each element in x to power and takes the mean. I've created three versions: power_mean_R: R solution -- mean(x^power) power_mean_C: C++ solution power_mean_C_2arg: C++ solution with extra power…
Jeff Bezos
  • 1,929
  • 13
  • 23
0
votes
1 answer

Apply lambda function to `arma::cube` in `RcppArmadillo`

I tried to use RcppArmadillo to compute the Frobenious norm across each slice of an array(arma::cube). The example code in file cxxFuns.cpp is presented below. // [[Rcpp::depends(RcppArmadillo)]] #include "RcppArmadillo.h" //…
zengc
  • 97
  • 9
0
votes
1 answer

RcppArmadillo, OpenMP and RNG seeds

What is currently the best solution to allow seed setting when using openMP? Simple example: #include "RcppArmadillo.h" using namespace Rcpp; using namespace arma; // [[Rcpp::depends(RcppArmadillo)]] // [[Rcpp::export]] vec rngtest(int N, double…
Inferrator
  • 77
  • 7
0
votes
0 answers

Rcpp Modules to Expose Class (Error: loadModule not found)

I am having trouble with setting up my package environment to expose cpp class to R as S4 method. I am trying to use Rcpp Modules. My class also uses RcppArmadillo. I created my initial package environment in RStudio as "Create package with…
statwanderer
  • 113
  • 6