Questions tagged [rcpparmadillo]
204 questions
0
votes
1 answer
How to build a constant matrix in Rcpp?
I'm a Rcpp user, in my cpp file, I need to use a matrix repeatedly. I want to define a constant matrix, but I don't know how to do it.
I used to defined a single constant double type variable in Rcpp and it works well for me. But when I repeat the…

Xia.Song
- 416
- 3
- 15
0
votes
2 answers
R package build error: '-std=c++11 or -std=gnu++11 compiler options'
I am trying to build an R package which includes Rcpp and RcppArmadillo code. sourceCpp() works fine and everything runs smoothly, but when I try to build the package I get: "This file requires compiler and library support for the
ISO C++ 2011…

Seth
- 19
- 4
0
votes
0 answers
Error in loading Rcpp/RcppArmadillo packages in Microsoft Open R
I have installed Microsoft Open R in my Windows 10 laptop for better performance. I am trying to use RcppArmadillo package. The package is installed properly but when I try to load it throws the following error.
Error: package or namespace load…

noirritchandra
- 103
- 9
0
votes
0 answers
Using RcppArmadillo with openmp on MacOS
I wrote a small package that uses RcppArmadillo. It compiles fine on Linux and on Windows but fails on MacOS. The error is:
clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG …

Philippe Massicotte
- 1,321
- 12
- 24
0
votes
0 answers
Rcpp function performance decrease when called from within another function
I'm rewriting some old code to use a new type of parameter representation. The old version was using matrices to represent parameters, while the new is using a List and an arma::fcube. I got a performance loss that's only observable when the…

VFreguglia
- 2,129
- 4
- 14
- 35
0
votes
2 answers
Parallel Worker in namespace
This example is a follow up example from this earlier post. I am trying to move the Parallel Worker to its own cpp file and and declare it in the header file.
Calling 'mypackage' function within public worker
The two errors are as follows:
1)…

skatz
- 115
- 7
-1
votes
1 answer
RcppArmadillo: diagonal matrix multiplication is very slow
Let x be a vector and M a matrix.
In R, I can do
D <- diag(exp(x))
crossprod(M, D%M)
and in RcppArmadillo, I have the following which is much slower.
#include
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::export]]
arma::mat…

manju
- 1
- 1
-2
votes
1 answer
"inner_product" was not declared in this scope
Hi I am new to rcpp and computing the inner product of two variables but getting an error "inner_product was not declared in this scope" for the following code:
#include
#include
#include
//…

sehrish sarfraz
- 1
- 1
-4
votes
1 answer
Extremely inefficient code written in C++
The computation time for the following function is very high. Is there any room for improvement? Should I be accessing the elements of matrix X differently? I appreciate any comments or suggestions.
#include
using namespace…

Hello
- 61
- 1
- 9