[Rcpp-devel] What is the best way of handling default arguments.

2012-05-24 Thread Andrew Redd
Rcpp List, Is there a recommended way to handle default arguments for constructors? I have a class that I have created and exposed through Rcpp Modules. I now found that I need to expose a tuning parameter and need to modify my constructors. The standard way would be to include just a default

Re: [Rcpp-devel] Rcpp and CUDA

2012-02-02 Thread Andrew Redd
Unless things have changed CUDA and R cpp don't always play nicely together. I have an example, that I wrote up I'll try and dig it up to send to you. The idea is that you must separate the CUDA code and Rcpp code and compile separately and then link together. There are some header conflicts in

[Rcpp-devel] Errors in constructors

2011-06-28 Thread Andrew Redd
Rcpp devs, I came across what might be a bug. There are residuals that are not cleaned up when a constructor throws an error. Consider the following. cpp file-- #include #include class testError{ public: testError(){ throw std::runtime_error("You shall not create ME!"

[Rcpp-devel] templated NA

2011-06-23 Thread Andrew Redd
Is there a templated version of NA with Rcpp, or perhaps some sugar statement, such that the following might be valid statements? typedef double mytime; const mytime time_unknown = Rcpp::NA; Thanks, Andrew ___ Rcpp-devel mailing list Rcpp-devel@lists.r-

Re: [Rcpp-devel] Rcpp Module Errors

2011-06-22 Thread Andrew Redd
la2 test::rcpp_hello_world > test::bla test::foo test::World > test::bla1 test::hello > > Regards, > Jonas > > > > > On Wed, Jun 22, 2011 at 12:51 AM, Andrew Redd wrote: > >> I apologize if this has been covered. I&

[Rcpp-devel] Rcpp Module Errors

2011-06-21 Thread Andrew Redd
I apologize if this has been covered. I've looked and see a couple of post relating to this issue, but I'm not sure if it was ever solved. The example modules appear to not work, at least for me. On a related note I can't get my modules to run either, but If I can figure out how to run the exampl

[Rcpp-devel] Error checking package that uses Rcpp

2011-05-09 Thread Andrew Redd
alEnv I will try and get a working example that reproduces the error, but while I do that I hope someone knows what the error might be. Thanks, Andrew Redd ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Re: [Rcpp-devel] R.e. Debugging Rcpp packages with GDB

2011-01-24 Thread Andrew Redd
Davor, A good place to start might be to mirror the behavior of the str in base R. That gives quick truncated information, the kind that is helpful in debugging. -Andrew On Mon, Jan 24, 2011 at 7:55 PM, Dirk Eddelbuettel wrote: > > On 24 January 2011 at 16:36, Davor Cubranic wrote: > | To fol

Re: [Rcpp-devel] Sugar seems slower than Rcpp.

2011-01-04 Thread Andrew Redd
Cedric, This was addressed about 2 weeks ago on the list, please read the archives. Basic point, Rcpp/sugar will not be faster than basic functions in R. Do something more complicated to see improvements. I would suggest something that involves lots of copies and edits, that will mess with R's m

Re: [Rcpp-devel] C++ Throwing Exception.

2010-12-22 Thread Andrew Redd
To chime in about Romain's comment about recognizing more types. I would love a more robust exception handling. I think I already mentioned that but sometimes throwing a std::exception can be very expensive. something a little bit more robust would be very helpful. For example, with the discus

[Rcpp-devel] Caching temporary results in long chains.

2010-12-09 Thread Andrew Redd
I'm having a problem with running long MCMC chains. When I run the chain for 1000 runs it takes about 30 seconds --- > n<-1e3 > time1<- system.time({ + run1 <- d3$run(n, 1,1, 1,1, 50) + }) > time1 user system elapsed 30.120 0.950 31.105 --- When I run for 100 000 runs I should expect so

Re: [Rcpp-devel] Interrupts in compiled code.

2010-12-08 Thread Andrew Redd
ow about just using R_CheckUserInterrupt()? > > Davor > > > On 2010-12-08, at 1:02 PM, Dirk Eddelbuettel wrote: > > > > > On 8 December 2010 at 13:41, Andrew Redd wrote: > > | I have an MCMC chain that runs entirely in c++ with Rcpp. It sometimes > runs > &

[Rcpp-devel] Interrupts in compiled code.

2010-12-08 Thread Andrew Redd
I have an MCMC chain that runs entirely in c++ with Rcpp. It sometimes runs for a vary long time and I want to interrupt it. Is there an efficient easy way to include catching an interupt signal and either aborting or returning results to that point? This might be understood well, if so I apolog

Re: [Rcpp-devel] object '.pointer' not found

2010-12-02 Thread Andrew Redd
you print the object, it bombs out. I'm narrowing this >> down, probably because of some oversight in the initialize method. >> >> Romain >> >> Le 02/12/10 20:36, Romain Francois a écrit : >> >>> That's odd that it only happens for your package

Re: [Rcpp-devel] object '.pointer' not found

2010-12-02 Thread Andrew Redd
I have a default constructor. -Andrew On Thu, Dec 2, 2010 at 12:34 PM, Dominick Samperi wrote: > > > On Thu, Dec 2, 2010 at 2:31 PM, Andrew Redd wrote: > >> That exposes the data3 class, but does not solve the pointer problem. > > > Add a default contructor. > >

Re: [Rcpp-devel] object '.pointer' not found

2010-12-02 Thread Andrew Redd
That exposes the data3 class, but does not solve the pointer problem. On Thu, Dec 2, 2010 at 12:24 PM, Romain Francois wrote: > Le 02/12/10 20:05, Andrew Redd a écrit : > > I updated to the new Rcpp 0.8.9 then added a new function to my class. >> It compiles fine the Module is

[Rcpp-devel] object '.pointer' not found

2010-12-02 Thread Andrew Redd
I updated to the new Rcpp 0.8.9 then added a new function to my class. It compiles fine the Module is found and loads the class definition seems to be there, but when I try to create a instance of the class I get the error: R> new(Module("GPU_BAYES",'gpuBayes')$data3) Error in get(".pointer", env

[Rcpp-devel] Error with sugar dnorm;

2010-11-24 Thread Andrew Redd
I'm having a problem with sugar expressions that I can't figure out. I have these two functions that are sampling and prior functions for two different parameters of an MCMC model. BTW this is part of my big CUDA project, so I pass these as pointers into other functions. --- numeric rb1(numeric a,

Re: [Rcpp-devel] potential new way to expose constructors

2010-11-21 Thread Andrew Redd
The init_2 is unnatural. I would prefer the new syntax. As I have to code that is relying in the init_2 at the moment I'm fine with switching it out. Does this mean that we will be able to expose multiple constructors? -Andrew On Sun, Nov 21, 2010 at 12:00 PM, Romain Francois wrote: > Hello, >

Re: [Rcpp-devel] Designing Rcpp modules - allow access to fields or to field accessor methods?

2010-11-18 Thread Andrew Redd
Isn't this sort of thing what the .property is for in modules? Or are you looking for something else -Andrew On Thu, Nov 18, 2010 at 2:31 PM, Douglas Bates wrote: > My C++ coding style (such as it is) has been influenced by reading > Frank Bokken's "C++ Annotations".  I keep most data members of

Re: [Rcpp-devel] Convention on where to put RCPP_MODULE declarations?

2010-11-15 Thread Andrew Redd
My two cents on this. Since I'm working on CUDA code, and CUDA for some reason does not like Rcpp I have to have a separate cpp file exclusively for the RCPP_MODULE, that does not include any cuda code. Then things are resolved in the linker. I'll always put RCPP_MODULE in a cpp file for my work.

Re: [Rcpp-devel] finding an undefined symbol

2010-11-04 Thread Andrew Redd
Figured it out. The definition for data3 is in a namespace, so it could not find the member functions. -Andrew On Thu, Nov 4, 2010 at 2:26 PM, Andrew Redd wrote: > Thanks for the post.  The data3 class is defined with > --- > #include > #include "types.h" //defines

Re: [Rcpp-devel] finding an undefined symbol

2010-11-04 Thread Andrew Redd
s",&data3::initSwabs) .method("setParameters", &data3::setParameters); } --- There is no initSwabs with only one parameter, is that what this is looking for? -Andrew On Thu, Nov 4, 2010 at 8:44 AM, Douglas Bates wrote: > > On Wed, Nov 3, 2010 at 2:22 PM, Andrew Redd

Re: [Rcpp-devel] Error loading modules

2010-11-04 Thread Andrew Redd
anRpackage ) > Le chargement a nécessité le package : anRpackage > Le chargement a nécessité le package : Rcpp > > yada <- Module( "yada", "anRpackage" ) > > yada$hello() > Erreur dans yada$hello() : boom > > The key is the second argument of Module

[Rcpp-devel] Error loading modules

2010-11-04 Thread Andrew Redd
I'm getting what I assume is a basic error, but I'm not sure what I'm doing wrong. Error in Module(module, mustStart = TRUE) : Failed to initialize module pointer: Error in FUN("_rcpp_module_boot_vecadd"[[1L]], ...): no such symbol _rcpp_module_boot_vecadd in package .GlobalEnv is the error whe

[Rcpp-devel] finding an undefined symbol

2010-11-04 Thread Andrew Redd
I'm writing a rather complicated package using CUDA and Rcpp. I have everything compile and link ok, but when loading I get a > "unable to load shared object ..." > "... undefined symbol: _ZN5data39initSwabsESt6vector..." Does anyone have any advice how to fix this and/or figure out what exactl

Re: [Rcpp-devel] Errors when just including Rcpp.h

2010-11-01 Thread Andrew Redd
I've attached the file of the errors now. I've also tried to change the order of includes without much success. -Andrew On Fri, Oct 29, 2010 at 5:10 PM, Dirk Eddelbuettel wrote: > > On 29 October 2010 at 16:26, Andrew Redd wrote: > | I have a class that I am building that

Re: [Rcpp-devel] Sugar

2010-11-01 Thread Andrew Redd
Doesn't sugar require Rcpp vectors, which encapsulate R SEXP vectors? If that is the case you really cannot separate them at all since there is a direct dependency on R. -Andrew On Mon, Nov 1, 2010 at 7:57 AM, Shane Conway wrote: > My two cents: > > That seems sensible; an alternative view wou

[Rcpp-devel] Errors when just including Rcpp.h

2010-10-29 Thread Andrew Redd
I have a class that I am building that I want to interface through Rcpp, but when I just include Rcpp, even without any Rcpp code included. I get several errors that appear to be template problems. What is going on here? I've attached the error output file. It compiles fine without including Rcpp

Re: [Rcpp-devel] Module with out default constructor.

2010-10-28 Thread Andrew Redd
te as good as vim. I'm right now developing on Ubuntu, since CUDA works much easier on it. -Andrew On Wed, Oct 27, 2010 at 7:36 PM, Romain Francois wrote: > Le 27/10/10 12:32, Andrew Redd a écrit : > > Is it possible with Rcpp Modules to have a class that does not have a >

[Rcpp-devel] Module with out default constructor.

2010-10-27 Thread Andrew Redd
Is it possible with Rcpp Modules to have a class that does not have a default constructor? Consider this example - #include #include class c1{ private: int n; int * x; c1(); public: c1(int n):n(n){} int getn(){return n;} }; RCPP_MODULE(c1){ using namespace Rcpp; class_("c1") .property("n",&c

Re: [Rcpp-devel] Named vectors

2010-09-09 Thread Andrew Redd
g++ -I"C:/PROGRA~1/R/R-211~1.1/include" -I"C:/PROGRA~1/R/R-211~1.1/library/pomp/include" -I"C:/PROGRA~1/R/R-211~1.1/library/Rcpp/include" -O2 -Wall -c file678418be.cpp -o file678418be.o g++ -shared -s -static-libgcc -o file678418be.dll tmp.def file678418be.o C:/

Re: [Rcpp-devel] Named vectors

2010-09-09 Thread Andrew Redd
named vector into an equivalent structure would be helpful. -Andrew On Thu, Sep 9, 2010 at 9:30 AM, Dirk Eddelbuettel wrote: > > Hi Andrew, > > On 9 September 2010 at 08:52, Andrew Redd wrote: > | What is the appropriate way to use/convert named vectors in C++ with > | Rcpp.  Basicall

[Rcpp-devel] Named vectors

2010-09-09 Thread Andrew Redd
Rcpp::NumericVector T(t); std::map Params(params); std::vector draws; for(int i=0;i Params(params); is not valid. But is shows more of less what I'm trying to do. Thanks, Andrew Redd ___