[Rcpp-devel] compiler warning (-Wdelete-non-virtual-dtor)

2013-03-10 Thread Greg Minshall
hi. i normally build under macosx, but trying to track down a memory problem have started using (the wonderful) valgrind under linux. the linux machine has a newer g++ (4.7.2 versus 4.2.1). the compiler on the linux machine was giving me warnings like: warning: deleting object of polymorphi

Re: [Rcpp-devel] pass-by-reference for reference objects

2013-03-09 Thread Greg Minshall
hi. a little more on this same subject. let's say one RCPP_EXPORT_CLASS's two classes: a and b, and let's say that b contains some number of a's (as std::vector, say). then, the following appear to be true: 1. if you pass one of the a's from a b object to a method of a, the a object is *copied

[Rcpp-devel] pass-by-reference for reference objects

2013-03-08 Thread Greg Minshall
hi. i have been trying to understand how to pass objects back and forth by reference (in order to avoid copying). this works smoothly if one is calling a method on the object. but, i was having trouble figuring this out for "free functions" (i.e., non-member functions, i.e., non-methods). the t

Re: [Rcpp-devel] extend to cover exporting non-reference S4 objects?

2013-03-07 Thread Greg Minshall
Dirk, thanks for the reply. i'll think about Nice Additions as i become more familiar with the magic of Rcpp. i would guess, since reference classes can make it, so can pass-by-value S4 objects. > In general, though, it helps to remember that we have to play the hand > we've been dealt. This i

[Rcpp-devel] constructors taking the same number of arguments

2013-03-07 Thread Greg Minshall
hi. the Rcpp-modules document, section 2.2.2, mentions that one can write a routine to disambiguate between different constructors taking the same number of arguments. i wonder, in the case one has *not* provided such a disambiguator, would it be possible to offer up an error message, maybe at co

[Rcpp-devel] extend to cover exporting non-reference S4 objects?

2013-03-07 Thread Greg Minshall
hi. i'm having a grand time with Rcpp. (though it's amazing how annoying procedural+non-REPL languages have become in the last decade that i've ignored them! ;-) in my application, some of my classes are a good fit for reference classes (large arrays). however, some of my classes are better as

Re: [Rcpp-devel] Simple List Operations

2013-03-06 Thread Greg Minshall
(since i've just been here...) .../unitTests/runit.Vector.R has these tests: test.List.erase <- function(){ fun <- list_erase d <- list( x = 1:10, y = letters[1:10] ) checkEquals(fun(d), list( y = letters[1:10] ), msg = "List.erase" ) } test.List.e

[Rcpp-devel] how to return an R list of reference objects

2013-03-06 Thread Greg Minshall
hi. i am again reporting some finding. (please let me know if this is not an appropriate use of the list) my question was, if i want to return from C++ an R list of reference objects (i.e., i'm using Rcpp::Module), how would i do that? the little test below appears to do this. cheers. t

[Rcpp-devel] RCPP_EXPORT_CLASS(std::vector)

2013-03-05 Thread Greg Minshall
hi. this is just me reporting on a learning exercise, in case it might be of help to someone else. the summary is that one might need to expose the types of member classes (in particular, *vector* types) of classes that are being exported with the RCPP_EXPOSED_CLASS directive. in compiling the f

[Rcpp-devel] segfault in Module...

2013-03-04 Thread Greg Minshall
hi. the scenario is use cxxfunction to create a module, load it, use it minimally, then *re*-load the module (by mistake -- well, actually, after a failed compile of modified code), attempt to use it. the result is *** caught segfault *** address 0xd8, cause 'memory not mapped' Traceback:

[Rcpp-devel] usage question (avoiding data copies)

2013-03-02 Thread Greg Minshall
hi, all. i've had great success speeding up my computations using Rcpp/C++. (thanks to the list for the help getting up and running.) but... now, when i scale up (from a 554x415 matrix to a 2592x1936 matrix), my run time slows down, and experimenting, it seems it's the cost of copying my datase

Re: [Rcpp-devel] Rcpp.package.create(attributes=TRUE)

2013-02-27 Thread Greg Minshall
> Fixed in rev 4273 -- thanks for the detailed and reproducible bug > report! great -- thanks!! ___ 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] Rcpp.package.create(attributes=TRUE)

2013-02-26 Thread Greg Minshall
Dirk, > Show reprocucible errors, or the mail doesn't exist ;-) works for me! (**) build the example skeleton with attributes=FALSE, "R CMD build", install.packages(), library(), run rcpp_hello_world(), note that a list with two items (each a 2 element vector) is returned. (or, just enter rcpp_h

[Rcpp-devel] Rcpp.package.create(attributes=TRUE)

2013-02-26 Thread Greg Minshall
hi. if i Rcpp.package.skeleton(), i get this single R file, anRpackage/R/rcpp_hello_world.R: rcpp_hello_world <- function(){ .Call( "rcpp_hello_world", PACKAGE = "anRpackage" ) } on the other hand, if i Rcpp.package.skeleton(attributes=TRUE), i get two R files: RcppExports.R and

Re: [Rcpp-devel] #ifdef'd out // [[Rcpp::export]]

2013-02-24 Thread Greg Minshall
J J, thanks. actually, if you track the source file line number, and inject "#line" directives around your injections, you don't need to rewrite error messages. e.g., let's say we're at line number 77 of file cluster.cc, and we see: // [[Rcpp::export]] int int_lots_in_one_out(std::list il)

Re: [Rcpp-devel] #ifdef'd out // [[Rcpp::export]]

2013-02-24 Thread Greg Minshall
Dirk, thanks for being tolerant of newbie confusion. i *am* looking at some other issue, though as it's in template-land, and i've lived a temperate template-free life heretofore, i may have to declare defeat. stay tuned. >| 2. alternatively, could you parse the output of "g++ -E" (rather >| t

Re: [Rcpp-devel] #ifdef'd out // [[Rcpp::export]]

2013-02-24 Thread Greg Minshall
JJ, thanks for the reply. i'm very sympathetic to not wanting to bundle a full-on C++ parser. two things i wonder: 1. could you, on seeing the [[Rcpp::export]], parse the succeeding function, then output your conversion code block, then output the lines (that you've already partially parsed) f

[Rcpp-devel] #ifdef'd out // [[Rcpp::export]]

2013-02-24 Thread Greg Minshall
hi. first, i should mention that i think Rcpp is amazing! i'm enjoying the learning process, and it speeds up my formerly-R code greatly. (some trivial image processing thing that i was only doing in R in order to combine two learning activities into one.) but... ;-) if i sourceCpp() the follow

[Rcpp-devel] error: expected unqualified-id before string constant

2013-02-24 Thread Greg Minshall
hi. another "find" in experimenting is that [[Rcpp::export]] and the RcppExport (in, e.g., // [[Rcpp::export]] RcppExport SEXP pass1(Rcpp::IntegerVector rgbtotype, Rcpp::IntegerMatrix pixmap, int toosmall) {...} are mutually exclusive. that's

[Rcpp-devel] error when formal argument name begins with an underscore

2013-02-24 Thread Greg Minshall
hi. i'm trying to understand the difference between using sourceCpp() and using R CMD compile/shlib. (i seem to get different results using the different methods.) if that's an FAQ, apologies, but any enlightenment would be appreciated! experimenting, i ran into this problem that i haven't seen