similar to: Help with integrating R and c/c++

Displaying 20 results from an estimated 2000 matches similar to: "Help with integrating R and c/c++"

2011 Apr 15
1
[Rcpp-devel] Find number of elements less than some number: Elegant/fastsolution needed
On Thu, Apr 14, 2011 at 7:02 PM, <rcpp-devel-request at r-forge.wu-wien.ac.at> wrote: > I was able to write a very short C++ function using the Rcpp package > that provided about a 1000-fold increase in speed relative to the best > I could do in R. ?I don't have the script on this computer so I will > post it tomorrow when I am back on the computer at the office. > >
2013 May 24
0
Rcpp with OpenMP - Need example Makevars
Dear R experts, recently I started developing a Rcpp package "OpenMPTest". Within that package I want to use OpenMP, as in the following code example: // header file #include <omp.h> using namespace Rcpp ; RcppExport SEXP testOpenMP( SEXP nThreads ) ; // cpp file SEXP testOpenMP( SEXP nThreads ) { BEGIN_RCPP NumericVector numberThreads = NumericVector( nThreads );
2011 Dec 05
1
RcppArmadillo compilation error: R CMD SHLIB returns status 1
Dear all, running the example by D. Eddebuettel (http://dirk.eddelbuettel.com/blog/2011/04/23/) I get an error message. Specifically, the R code I was taking from the above example is ### BEGIN EXAMPLE ### suppressMessages(require(RcppArmadillo)) suppressMessages(require(Rcpp)) suppressMessages(require(inline)) code <- ' arma::mat coeff = Rcpp::as<arma::mat>(a); arma::mat
2020 Nov 21
3
Two ALTREP questions
Hello, I have two related ALTREP questions. It seems like there is no way to assign attributes to an ALTREP vector without using C++ code. To be more specifically, I want to make an ALTREP matrix, I have tried the following R code but none of them work. ``` .Internal(inspect(1:6)) .Internal(inspect(matrix(1:6, 2,3))) .Internal(inspect(as.matrix(1:6))) .Internal(inspect(structure(1:6, dim =
2011 Nov 17
3
.Call in R
Hi R developers, I am new to this forum and hope someone can help me with .Call in R. Greatly appreciate any help! Say, I have a vector called "vecA" of length 10000, I generate a vector called "vecR" with elements randomly generated from Uniform[0,1]. Both vecA and vecR are of double type. I want to replace elements vecA by elements in vecR only if sum of elements in
2011 Feb 20
2
Problem using F77_CALL(dgemm) in a package
Dear R-devel, I've written a numerical solver for SOCPs (second order cone programs) in R, and now I want to move most of the solver code into C for speed. I've written combined R/C packages before, but in this case I need to do matrix operations in my C code. As I have never done that before, I'm trying to write some simple examples to make sure I understand the basics. I am stuck
2011 Feb 17
2
Newbie Rccp module question. "Failed to initialize module pointer"???
Hi all. I started looking at Rcpp, which looks pretty great, actually. At the moment just trying to compile a module to get a feel how it all works without fully understanding how all the pieces fit together. Basically, i took the first example from Rcpp modules vignette: fun.cpp ======================== #include <Rcpp.h> #include <math.h> using namespace Rcpp; double
2011 Oct 12
1
Error in Rcpp/inline (Windows XP)
Hi, everyone, I am just trying to use Rcpp in my computer, and I would like to try a simple example from website, but R keeps reporting me error. I am using Windows XP, and has installed Rtools and GSI. Here is the response: > src = ' + Rcpp::NumericVector xa(a); + Rcpp::NumericVector xb(b); + int n_xa = xa.size(); + int n_xb = xb.size(); + + Rcpp::NumericVector xab(n_xa + n_xb - 1);
2012 May 03
1
Setting up a windows system for rcpp
I am running into a wall getting my system to work with rcpp and inline. Following Dirk's advice on stackoverflow, I hope someone is able to help me. My steps were to install MinGW 32 bit first, then installing Rtools, I disabled MinGW's entry in the PATH. I am trying to get the following code to work: library(Rcpp) library(inline) body <- ' NumericVector xx(x); return wrap(
2010 Nov 22
4
How to call R from C
Hi all! I read R Extensions manual. But still I am not sure how to call R functions from C. Would any of you give me a sample C code to show how to call R functions - for instance, time series functions - from C in the embedded way of C code? [[alternative HTML version deleted]]
2011 Feb 21
1
Mutiplying a data frame to a list
Hi R community, I have a question I'm sure is very simple for most of you. I have a list, with each element being a matrix and the names of the elements are numbers (like 1,3,...). I can extract the matrices and the names individually. Now, I want to multiply each of the names to the individual list matrices (after converting to numbers of course). I could use a for loop, but the very
2011 Sep 20
2
Is it possible to pass a function argument from R to compiled code in C?
I have a function in R that takes another function as argument: f <- function(g, ...) { #g is expected to be a function } I want to see if there is a way to implement "f" in C and calling it from R using ".C" interface. I know that I can use function pointers for my C implementation, but I imagine it's going to be nearly impossible to pass a function from R to C. Are
2011 May 03
3
help with the maxBHHH routine
Hello R community, I have been using R's inbuilt maximum likelihood functions, for the different methods (NR, BFGS, etc). I have figured out how to use all of them except the maxBHHH function. This one is different from the others as it requires an observation level gradient. I am using the following syntax: maxBHHH(logLik,grad=nuGradient,finalHessian="BHHH",start=prm,iterlim=2)
2010 Jul 26
1
O/T good c/c++ code for LU decomposition
Dear R People: Could someone recommend a good c/c++ code (or Fortran) for LU decomposition, please? Sorry to bother about this. I'm trying to do some "non-R" work that requires a matrix inversion. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodgess at gmail.com
2010 Jun 19
2
Call by reference or suggest workaround
I have written code to compute multi-indices in R [1] and due to the recursive nature of the computation I need to pass around the *same* matrix object (where each row corresponds to one multi-index). As pass by reference wasn't the default behavior I declared a global matrix (mat) and used the <<- operator to write to the global matrix. So the usage would be to call genMultiIndices(3,2)
2010 Oct 27
2
must .Call C functions return SEXP?
For using R's .Call interface to C functions, all the examples I've seen have the C function return type SEXP. Why? What does R actually do with this return type? What happens if I *don't* return a SEXP? Reason I ask, is I've written some R code which allocates two long lists, and then calls a C function with .Call. My C code writes to those two pre-allocated lists, thus, I
2011 Mar 15
1
Questions on dividing lists and tapply
Hello R community, I have two questions about using R. The first is about dividing each element of a list with another similar sized list. So, if the first list has two elements and so does the second, then the result should also be a list with two elements. For example, the inputs are: list(matrix(1:6,ncol=2),matrix(1:6,ncol=2))->l1 l2<-list(1:3,2) I want to get a list, l3 with the
2011 Jun 04
2
Interfacing a C++ class
Hello Apologies for cross-posting, the discussion should (if) go to R-devel, but I also want to reach the rcpp-devel people. My C++ class FOO is a module available through Rcpp, and it works fine and is -- so far -- bug free. With trying to further develop my R package, I thought it was a good idea to interface my C++ workhorse FOO with an S4 class Foo. After some long and not always insightful
2010 Jun 18
4
C Interface
Greetings, I am trying to call simple C-code from R. I am on Windows XP with RTools installed. The C-function is #include <R.h> #include <Rinternals.h> #include <Rmath.h> #include <Rdefines.h> // prevent name mangling extern "C" { SEXP __cdecl test(SEXP s){ SEXP result; PROTECT(result = NEW_NUMERIC(1)); double* ptr=NUMERIC_POINTER(result); double t =
2018 Dec 06
2
Re: Libvirt api for esx
Thanks Martin for help. I will give it a shot. Regards Rohit Singh On Thu, 6 Dec 2018 at 2:55 PM, Martin Kletzander <mkletzan@redhat.com> wrote: > On Wed, Dec 05, 2018 at 09:44:17PM +0530, ROHIT SINGH wrote: > >Hi Martin, > > > >Could you please help me with below issue, I am not sure what’s wrong > here. > >Please find below code and error snippet. > >