> switch(x.sexp_type()) {
> case REALSXP:
> return wrap(unique1(as(x)));
> break;
> case INTSXP:
> return wrap(unique1(as(x)));
> break;
> case CHARSXP:
That should be STRSXP, of course.
Hadley
--
RStudio / Rice University
http://had.co.nz/
Hi all,
I've attached a simple implementation of unique for numeric, integer,
logical, and character vectors. To do that I have four C++ function,
along the lines of :
std::tr1::unordered_set unique1(NumericVector x) {
return std::tr1::unordered_set(x.begin(), x.end());
}
and then one exporte
>> I don't think they _have_to - my understanding is that the expression
>> template approach is general enough that you could compile away those
>> intermediates. It may be extremely difficult to do though!
>
> That's the issue in delayed evaluation. You do a lot of template magic to
> discover
> In my case, informed by interesting benchmarks such as yours, I now tend
> to write my R functions with optimizing to C++ in mind. In other words,
> I've stopped being ashamed of having loops in my R code.
>
> If my R script completes Quick Enough I don't care. But when it takes
> Too Long, I kno
On Tue, Nov 20, 2012 at 9:54 AM, Hadley Wickham wrote:
> > P.S. I don't think the sugar versions can be made any quicker, because
> > they have to allocate intermediate vectors, and do more memory copies.
>
> I don't think they _have_to - my understanding is that the expression
> template approac
On 20 November 2012 at 09:40, Douglas Bates wrote:
| I'd reply to your questions that yes Sebastian Villemot and Elliot Saba are
| working on the Debian packaging (last weekend there was a big commit that
| reorganized the files to facilitate this) and Jeff has announced
comprehensions
| on distr
>> I think you could do it a bit more elegantly with
>>
>> gender <- 0.75 + female * 0.5
>>
>> but pmin and pmax are "real" primitives, so I think it's fine to use them.
>
>
> In the folklore ifelse, pmin and pmax are know to be slow. I know that
> there was some work on pmin and pmax but I think
> P.S. I don't think the sugar versions can be made any quicker, because
> they have to allocate intermediate vectors, and do more memory copies.
I don't think they _have_to - my understanding is that the expression
template approach is general enough that you could compile away those
intermediate
On Mon, Nov 19, 2012 at 11:36 AM, Hadley Wickham wrote:
> > To be fair with the R language, I would have compare with the use of real
> > primitives :
> >
> > vaccBubu <- function(age, female, ily) {
> > gender <- female * 1.25
> > gender[!female] <- 0.75
> > p <- (0.25 + 0.3 * 1 / (1
I'd reply to your questions that yes Sebastian Villemot and Elliot Saba are
working on the Debian packaging (last weekend there was a big commit that
reorganized the files to facilitate this) and Jeff has announced
comprehensions on distributed arrays, although I haven't tried using it yet.
Howeve
10 matches
Mail list logo