The Eigen tensor module (easily available via RcppEigen as far as I can
tell) might be worth a look:
http://eigen.tuxfamily.org/index.php?title=Tensor_support
On Wed, Apr 18, 2018 at 3:13 AM, Dirk Eddelbuettel wrote:
>
> On 18 April 2018 at 01:56, Avraham Adler wrote:
> | May not be possible. Se
Perhaps use the clone() function?
library(Rcpp)
cppFunction("
NumericVector par_CMAtR(NumericVector vec_CMA) {
NumericVector out = clone(vec_CMA);
out[5] = exp(out[5]);
return out;
}
")
vec_C <- rep(1, 6)
par_CMAtR(vec_C)
print(vec_C)
On Thu, Feb 26, 2015 at 3:16 PM, Pierre GLOAGUEN
I think you need to use the `includes` argument of cxxfunction to include a
pure c++ function ie;
library(inline)
library(Rcpp)
inc <-'
int fun1(double x, double y) {
return (exp(x) - y) > 0 ? 1 : 0;
}
'
body <-'
NumericVector u = as(u_r);
do
Would it be useful to consider using the Function class in Rcpp? You can
pass R functions in as arguments like so;
library(inline)
library(Rcpp)
example <- cxxfunction(signature(f_ = "Function"), body = '
Rcpp::Function f(f_);
Rcpp::NumericVector out = f(10, 1);
rom:* Jonathan Olmsted [mailto:jpolms...@gmail.com]
> *Sent:* Tuesday, September 25, 2012 4:29 PM
> *To:* Jeffrey Pollock
>
> *Cc:* Goldfeld, Keith; rcpp-devel@lists.r-forge.r-project.org
> *Subject:* Re: [Rcpp-devel] NumericVector Double mismatch when indexing
> an array**
I was interested to see if there was any real speed difference between the
different methods suggested, and it looks like... there isn't...
library(inline)
library(Rcpp)
library(rbenchmark)
fun1 <- cxxfunction(body = '
RNGScope scope;
NumericVector rn(5);
Try;
require(Rcpp)
require(inline)
check2 <- cxxfunction(signature(arg1 = "numeric", arg2 = "numeric"), '
NumericVector q(arg1);
double mean = as(arg2);
double sd = 1.0;
return wrap(qnorm(q, mean, sd));
', plugin = "
One way of speeding that up would be to use `glm.fit` instead of `glm`. It
just means you'll have to calculate a few extra variables outside the loop
(which `glm` will be calculating every time you call it).
On Fri, Jan 13, 2012 at 2:53 PM, Jason LaCombe <
jlaco...@naturesourcegenetics.com> wrote:
18.59 0.02
------ Forwarded message --
From: Jeffrey Pollock
Date: Tue, Dec 13, 2011 at 11:48 PM
Subject: Rcpp too good to be true?
To: r-de...@r-project.org
Hello all,
I've been working on a package to do various things related to the
Conway-Maxwell-Poisson distribution and wan
I had a bash at this as I'm currently learning some C++ / Rcpp. I made a
function where you pass in the row start index and row end index, and the
desired matrix column (which is what I assumed you would want).
Here is the code I came up with including some benchmarks I ran,
interestingly, using a
Hey Christian,
Thanks very much for the great reply! Will do some more testing and post my
results hopefully sometime next week.
Jeff
On Fri, Sep 16, 2011 at 11:18 PM, Christian Gunning wrote:
> Jeff,
>
> A few random comments in addition to Dirk's sound advice:
>
> 1. I recommend using bigge
ettel wrote:
>
> Hi Jeffrey,
>
> And welcome! Thanks for a detailed post with examples and benchmarks!
>
> On 16 September 2011 at 14:48, Jeffrey Pollock wrote:
> | Hello all,
> |
> | I've recently started looking into the speed gains from using Rcpp and
> have
>
Hello all,
I've recently started looking into the speed gains from using Rcpp and have
began looking into the arma library too. Ive written a small loop to fill in
a matrix and done so using the arma::mat class and the Rcpp::NumericMatrix
class. In this case, the Rcpp::NumericMatrix class was slig
Hello,
I'm trying to get Rcpp to work on my machine running Windows 7 64 bit but
I'm not having much luck!
I've reinstalled R in: C:\opt\R-2.13.1
and have: C:\Rtools\MinGW64
my path variables are set as:
C:\Rtools\bin;C:\Rtools\perl\bin;C:\Rtools\MinGW64\bin;C:\opt\R-2.13.1\bin\x64;C:\Program
Fil
14 matches
Mail list logo