search for: cppfunction

Displaying 20 results from an estimated 33 matches for "cppfunction".

2018 Mar 19
1
help needed on RcppEigen....
...led my research. I am using Rcpp to speed up my "for" loop. I am also using RcppEigen to implement block operations on xts objects..... how do I use RcppEigen? If I just load it by: > require(RcppEigen) it is not recognising the .block method in C++. If I include it inside the cppFunction: > cppFunction(' include <RcppEigen.h> .....body') I get the following error: > error: "include doesn't name a type" My question is : how do I manipulate the installed RcppEigen package for the cppFunction to recognize block operations that are part of the E...
2015 Mar 02
3
R-devel does not update the C++ returned variables
.... It has its own learning curve, but I think >> | it is easier than using the low-level code that you need to work with .Call. > >> Thanks for that vote, and I second that. > >> And these days the learning is a lot flatter than it was a decade ago: > >> R> Rcpp::cppFunction("NumericVector doubleThis(NumericVector x) { return(2*x); }") >> R> doubleThis(c(1,2,3,21,-4)) >> [1] 2 4 6 42 -8 >> R> > >> That defined, compiled, loaded and run/illustrated a simple function. > >> Dirk > > Indeed impressive, ... and i...
2015 Mar 02
1
R-devel does not update the C++ returned variables
...the interface. It has its own learning curve, but I think | > | it is easier than using the low-level code that you need to work with .Call. | | > Thanks for that vote, and I second that. | | > And these days the learning is a lot flatter than it was a decade ago: | | > R> Rcpp::cppFunction("NumericVector doubleThis(NumericVector x) { return(2*x); }") | > R> doubleThis(c(1,2,3,21,-4)) | > [1] 2 4 6 42 -8 | > R> | | > That defined, compiled, loaded and run/illustrated a simple function. | | > Dirk | | Indeed impressive, ... and it also works with...
2015 Mar 02
3
R-devel does not update the C++ returned variables
...nk about the real | problem, not the interface. It has its own learning curve, but I think | it is easier than using the low-level code that you need to work with .Call. Thanks for that vote, and I second that. And these days the learning is a lot flatter than it was a decade ago: R> Rcpp::cppFunction("NumericVector doubleThis(NumericVector x) { return(2*x); }") R> doubleThis(c(1,2,3,21,-4)) [1] 2 4 6 42 -8 R> That defined, compiled, loaded and run/illustrated a simple function. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
2013 May 14
2
invalid operands of types ‘SEXPREC*’ and ‘R_len_t’ to binary ‘operator/’ with Rcpp.
...nction)’: file74d8254b96d4.cpp:10: error: invalid operands of types ‘SEXPREC*’ and ‘R_len_t’ to binary ‘operator/’ make: *** [file74d8254b96d4.o] Error 1 Below is a mock function that can reproduce this error. I wonder if anyone can tell me what is the problem here. Thank you in advance!! foo<-cppFunction(' NumericVector foo(NumericVector q, NumericVector shape1, NumericVector shape2, Function pbeta, Function sequence){ NumericVector output(q.size()); output=pbeta(sequence(q.size())/q.size(), shape1, shape2); return output; } ') Best, Xiao [[alternative HTM...
2015 Mar 02
0
R-devel does not update the C++ returned variables
...hink >>> | it is easier than using the low-level code that you need to work >>> with .Call. >> >>> Thanks for that vote, and I second that. >> >>> And these days the learning is a lot flatter than it was a decade ago: >> >>> R> Rcpp::cppFunction("NumericVector doubleThis(NumericVector x) { >>> return(2*x); }") >>> R> doubleThis(c(1,2,3,21,-4)) >>> [1] 2 4 6 42 -8 >>> R> >> >>> That defined, compiled, loaded and run/illustrated a simple function. >> >>> Dir...
2010 May 17
0
Rcpp 0.8.0 on CRAN
...C++ programs. ===== inline use ===== Rcpp depends on the inline package by Oleg Sklyar et al. Rcpp then uses the 'cfunction' provided by inline (with argument Rcpp=TRUE) to compile, link and load C++ function from the R session. As of version 0.8.0 of Rcpp, we also define an R function cppfunction that acts as a facade function to the inline::cfuntion, with specialization for C++ use. This allows quick prototyping of compiled code. All our unit tests are based on cppfunction and can serve as examples of how to use the mechanism. For example this function (from the runit.GenericVector.R uni...
2010 May 17
0
Rcpp 0.8.0 on CRAN
...C++ programs. ===== inline use ===== Rcpp depends on the inline package by Oleg Sklyar et al. Rcpp then uses the 'cfunction' provided by inline (with argument Rcpp=TRUE) to compile, link and load C++ function from the R session. As of version 0.8.0 of Rcpp, we also define an R function cppfunction that acts as a facade function to the inline::cfuntion, with specialization for C++ use. This allows quick prototyping of compiled code. All our unit tests are based on cppfunction and can serve as examples of how to use the mechanism. For example this function (from the runit.GenericVector.R uni...
2024 Dec 18
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
...; functions in the 'stats' package, e.g., pwilcox(). >>>> >>>> The following MWE (using Rcpp) illustrates the problem. Consider the >>>> following code: >>>> >>>> --- >>>> >>>> library(Rcpp) >>>> cppFunction('double nonsense(const int n, const int m, const int check) { >>>> int i, j; >>>> double result; >>>> for (i=0;i<n;i++) { >>>> if (check) R_CheckUserInterrupt(); >>>> result = 1.; >>>> for (...
2010 May 11
1
[LLVMdev] LLVMGetPointerToFunction
Hi, Is there such a function (or a similar one) which is callable using the c-binding llvm? Many thanks, Georg -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100511/d49c75d2/attachment.html>
2023 Apr 12
1
Matrix scalar operation that saves memory?
One possibility might be to use Rcpp. An R matrix is stored in contiguous memory, which can be considered as a vector. Define a C++ function which operates on a vector in place, as in the following: library(Rcpp) cppFunction( 'void subtractConst(NumericVector x, double c) { for ( int i = 0; i < x.size(); ++i) x[i] = x[i] - c; }') Try this function out on a matrix. Here we define a 5x2 matrix m <- matrix(150.5 + 1:10, nrow=5) print(m) [,1] [,2] [1,] 151.5 156.5 [2,] 152.5 157.5 [3,] 153.5...
2016 Jan 10
3
coerce SEXP type to C++ matrix class and back
Dear all, I am testing a simple C++ function that takes a double matrix as argument and which uses routines provided by the C++ Armadillo package. I am aware of the nice capabilities of Rcpp and RcppArmadillo which helps simplifying a lot and that I have already successfully tested. However, I had a hard time trying to figure out how the coercion from a REALSPX matrix to an arma::mat =
2016 Nov 12
2
Ubuntu 16.10 Yakkety Yak uses GCC 6 but -std=c++98 is missing
...| more than one are given on the same command line [1]. | | Good to know it works. | | I am still a little puzzled why it was needed when it doesn't seem to be | needed on the Debian side. I just upgraded an old (unused, underpowered) box to 16.10 as a first test. No issues so far, and basic cppFunction("...") tests with Rcpp work. Could you get us a minimal reproducible example of what broke without the explicit -std=c++98 ? Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
2024 Dec 17
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
...R_CheckUserInterrupt() from negligible to critical (in real-world applications). Significant performance drops are also visible for functions in the 'stats' package, e.g., pwilcox(). The following MWE (using Rcpp) illustrates the problem. Consider the following code: --- library(Rcpp) cppFunction('double nonsense(const int n, const int m, const int check) { int i, j; double result; for (i=0;i<n;i++) { if (check) R_CheckUserInterrupt(); result = 1.; for (j=1;j<=m;j++) if (j%2) result *= j; else result /=j; } return(result); }') tmp1 <- system.t...
2024 Dec 17
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
...itical (in real-world > applications). Significant performance drops are also visible for > functions in the 'stats' package, e.g., pwilcox(). > > The following MWE (using Rcpp) illustrates the problem. Consider the > following code: > > --- > > library(Rcpp) > cppFunction('double nonsense(const int n, const int m, const int check) { > int i, j; > double result; > for (i=0;i<n;i++) { > if (check) R_CheckUserInterrupt(); > result = 1.; > for (j=1;j<=m;j++) if (j%2) result *= j; else result /=j; > } > retu...
2024 Dec 18
2
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
...also visible for >>> functions in the 'stats' package, e.g., pwilcox(). >>> >>> The following MWE (using Rcpp) illustrates the problem. Consider the >>> following code: >>> >>> --- >>> >>> library(Rcpp) >>> cppFunction('double nonsense(const int n, const int m, const int check) { >>> int i, j; >>> double result; >>> for (i=0;i<n;i++) { >>> if (check) R_CheckUserInterrupt(); >>> result = 1.; >>> for (j=1;j<=m;j++) if (j%2) resu...
2024 Dec 17
1
R_CheckUserInterrupt() can be a performance bottleneck within GUIs
...ons). Significant performance drops are also visible for >> functions in the 'stats' package, e.g., pwilcox(). >> >> The following MWE (using Rcpp) illustrates the problem. Consider the >> following code: >> >> --- >> >> library(Rcpp) >> cppFunction('double nonsense(const int n, const int m, const int check) { >> int i, j; >> double result; >> for (i=0;i<n;i++) { >> if (check) R_CheckUserInterrupt(); >> result = 1.; >> for (j=1;j<=m;j++) if (j%2) result *= j; else resu...
2015 Mar 02
0
R-devel does not update the C++ returned variables
...problem, not the interface. It has its own learning curve, but I think > | it is easier than using the low-level code that you need to work with .Call. > Thanks for that vote, and I second that. > And these days the learning is a lot flatter than it was a decade ago: > R> Rcpp::cppFunction("NumericVector doubleThis(NumericVector x) { return(2*x); }") > R> doubleThis(c(1,2,3,21,-4)) > [1] 2 4 6 42 -8 > R> > That defined, compiled, loaded and run/illustrated a simple function. > Dirk Indeed impressive, ... and it also works with integer vectors so...
2013 Nov 26
1
dynamic lists at C level
Dear R-devel, I am trying to do something similar to dynamic length lists in R, but at C level. In R, that would be rather trivial: - determine the length of the list - create the list object - store the values for each component - access value components by using "[[" At C level, for a single component where I need to store a vector of length 5, I do: int *p_result; SEXP my_list =
2014 Jan 15
1
rbinom in RcppArmadillo?
What is the RcppArmadillo way to make binomial draws from a vector of probs, similar to what rbinom does in R? Thanx! -- View this message in context: http://r.789695.n4.nabble.com/rbinom-in-RcppArmadillo-tp4683593.html Sent from the R devel mailing list archive at Nabble.com.