search for: cppfunction

Displaying 20 results from an estimated 28 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...
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
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.
2014 Mar 16
1
How to convert time_t to R date object
Hi all, I am writing a R extensions, and I need pass time_t to R in C, but I don't know how to do. Can you give me some help? do not use double directly. Thanks, Bill -- *Travel | Programming* *http://freecnpro.net* <http://freecnpro.net> [[alternative HTML version deleted]]
2023 Apr 12
1
Matrix scalar operation that saves memory?
I doubt that R's basic matrix capabilities can handle this, but have a look at the Matrix package, especially if your matrix is some special form. Bert On Tue, Apr 11, 2023, 19:21 Shunran Zhang <szhang at ngs.gen-info.osaka-u.ac.jp> wrote: > Hi all, > > I am currently working with a quite large matrix that takes 300G of > memory. My computer only has 512G of memory. I
2015 Nov 03
1
Fwd: Rcpp sugar dpois
Hi. Here is a piece of cpp code. It works, but I do not understand the rational for the use of "R::dpois" to call the function dpois since in the examples I have always found directly "dpois" or "Rcpp::dpois" that both do not work in my code. Could anyone be so patient to explain me why should it be like that? Thaks a lot, Enrico #include <Rcpp.h> using
2016 Nov 12
0
Ubuntu 16.10 Yakkety Yak uses GCC 6 but -std=c++98 is missing
...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 ? > When I posted, there was only "xenial", not "yakkety", on CRAN. This has changed now (thanks a lot!). When I try to upgrade...
2016 Nov 12
3
Ubuntu 16.10 Yakkety Yak uses GCC 6 but -std=c++98 is missing
Thanks. I have now CXX = g++ -std=c++98 in my /etc/R/Makeconf, it's picked up properly. I can only assume that the last -std= option wins if more than one are given on the same command line [1]. -Kirill [1] http://stackoverflow.com/q/40563269/946850 On 12.11.2016 03:01, Dirk Eddelbuettel wrote: > On 11 November 2016 at 23:48, Kirill M?ller wrote: > | After upgrading to Ubuntu