[Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Cedric Ginestet
Hi guys, I want to produce discrete uniform variates within C++ from the runif() function available through Rcpp Sugar. However, I don't seem to be able to find the appropriate cast in order to return an IntegerVector as opposed to a numeric one. I have naively used int(), but this is clearly

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Dirk Eddelbuettel
On 13 April 2011 at 12:19, Cedric Ginestet wrote: | Hi guys, | | I want to produce discrete uniform variates within C++ from the runif() | function available through Rcpp Sugar. However, I don't seem to be able to find | the appropriate cast in order to return an IntegerVector as opposed to a |

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Cedric Ginestet
Brilliant, Dirk. Thanks for that. Next time, I'll read the Rcpp Sugar .pdf more carefully. Cheers, On 13/04/11 12:43, Dirk Eddelbuettel wrote: On 13 April 2011 at 12:19, Cedric Ginestet wrote: | Hi guys, | | I want to produce discrete uniform variates within C++ from the runif() | function avai

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Douglas Bates
On Wed, Apr 13, 2011 at 6:50 AM, Cedric Ginestet wrote: > Brilliant, Dirk. Thanks for that. > Next time, I'll read the Rcpp Sugar .pdf more carefully. > Cheers, Be aware that in both versions you will never return a vector containing b, which might be confusing. That is, the argument b should be

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Cedric Ginestet
Thanks Douglas for being picky! I have indeed noted that I needed to use b+1 in my codes to produce discrete uniform variates. However, I am not too sure that I understand how to use RNGScope properly. I originally referred to the Rcpp Sugar codes provided in the Rcpp-introduction .pdf document

Re: [Rcpp-devel] Cast for output of Rcpp Sugar runif()

2011-04-13 Thread Douglas Bates
As Dirk pointed out to me off-list, I shouldn't reply to email before coffee. It was my mistake - you had indeed used RNGscope properly. On Wed, Apr 13, 2011 at 8:27 AM, Cedric Ginestet wrote: > Thanks Douglas for being picky! > I have indeed noted that I needed to use b+1 in my codes to produce

Re: [Rcpp-devel] Conflit with sys/vnode.h on Solaris (gcc 4.4.3)

2011-04-13 Thread Giuseppe Milicia
On Tue, Apr 12, 2011 at 11:11 AM, Giuseppe Milicia wrote: > Dirk, > > I steer away from the Solaris compiler, too many headaches there... > > I'm currently using gcc 4.4.3 > > I tried rearranging the headers (in my code) but I got nowhere :( I suspect > this is the case because sys/vnode.h is >

Re: [Rcpp-devel] Conflit with sys/vnode.h on Solaris (gcc 4.4.3)

2011-04-13 Thread Dirk Eddelbuettel
On 13 April 2011 at 16:51, Giuseppe Milicia wrote: | >Can you use qualified names, as in Rcpp::as, or would that mean | >rewriting most of the Rcpp headers? | | Doing that actually solves the problem and seems to be limited to modifying 3 lines in two headers RObject.h and Environment.h | | Ess

[Rcpp-devel] Use size_t rather than int for vector sizes and indexing?

2011-04-13 Thread chuck
Hi All, Thanks to Dirk Eddelbuettel and the other contributors for such a wonderful package. Rcpp really transforms the way that I've been able to incorporate c++ code into R. Makes it possible to speed up the critical computations while keeping all the great flexibility and features of R. I've

Re: [Rcpp-devel] Use size_t rather than int for vector sizes and indexing?

2011-04-13 Thread Jay Emerson
Chuck, Internally, R is using 4-byte integers for indexing, and the length of a vector is thus constrained to 2-billion-ish elements. Two ways around this include packages ff and bigmemory, for example, or relying on database-like queries. However, the resulting objects can't be used with standa

Re: [Rcpp-devel] Use size_t rather than int for vector sizes and indexing?

2011-04-13 Thread chuck
Thanks Jay for the lightning fast insightful response! Didn't realize that this limitation was intrinsic to R itself. I'll have to go look at bigmemory and some of the other projects. Thanks, -Chuck On Wed, 13 Apr 2011 14:11:25 -0400, Jay Emerson wrote: > Chuck, > > Internally, R is using 4-by

Re: [Rcpp-devel] Use size_t rather than int for vector si zes and indexing?

2011-04-13 Thread Dirk Eddelbuettel
Hi Chuck, Thanks for posting here. On 13 April 2011 at 12:22, ch...@chuckcode.com wrote: | Thanks Jay for the lightning fast insightful response! Didn't realize that | this limitation was intrinsic to R itself. I'll have to go look at | bigmemory and some of the other projects. Yes, Rcpp uses '

Re: [Rcpp-devel] Use size_t rather than int for vector si zes and indexing?

2011-04-13 Thread chuck
Thanks for the pointer Dirk (or in this case Rcpp::XPtr), I'll definitely take a look at this. Have to go back to the drawing board a bit as I'd currently been using a lot of built-in R functions so switching to bigmemory will be a bit non-trivial. I promise I'll make a demo if I get that far thou

[Rcpp-devel] Rcpp-introduction published as JSS 40(8); Rcpp 0.9.4 out too

2011-04-13 Thread Dirk Eddelbuettel
The Journal of Statistical Software has just published what is also the Rcpp-introduction.pdf vignette in the package. This coincides with the release of Rcpp 0.9.4 which arrived at CRAN yesterday and which now contains the citation info: R> citation("Rcpp") To cite Rcpp in publications use:

Re: [Rcpp-devel] R.e. loadRcppModules

2011-04-13 Thread Christian Gunning
On Tue, Apr 12, 2011 at 11:07 PM, Romain Francois wrote: >> >> Just to clarify --  does your plan include storing user-modified >> fields and properties in objects?  E.g. below, modtest with the msg >> set? > > yes. Although the way I see it, this will require more work for the > developper, who w