[Rcpp-devel] R vectorisation vs. C++ vectorisation

Douglas Bates bates at stat.wisc.edu
Tue Nov 20 16:40:44 CET 2012


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.

However, the list administrator has told me not to discuss Julia on this
list so I won't :-)

On Mon, Nov 19, 2012 at 10:54 AM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 19 November 2012 at 10:47, Douglas Bates wrote:
> | Sigh.  Speaking as one of the "Julia guys" I should point out two things
> (not
> | that they will change Dirk's "cold, dead hands" attitude towards Julia
> :-)
>
> No, just "lazy apt-get-able awaiting" hands.
>
> | 1. Comprehensions provide what I feel is a clean syntax for sugar-like
> | operations in Julia
> |
> | 2. A problem with vectorization is the issue of multiple loops, hence the
> | number of attempts at implementing delayed evaluation in compiled code
> (Eigen)
> | and in add-on's to R.
> |
> | A translation of Hadley's vacc3 into Julia could be
> |
> | function vacc3a(age::Float64, female::Bool, ily::Float64){
> |   p = 0.25 + 0.3 * 1 / (1 - exp(0.04 * age)) + 0.1 * ily
> |   p *= female ? 1.25 : 0.75
> |   min(max(0., p), 1.)
> | }
> |
> | out = [vacc3a(age[i], female[i], ily[i]) for i in 1:length(age)]
> |
> | The comprehension collapses the
> |  1. Determine the length of the output vector
> |  2. Allocate the result
> |  3. Loop over indices populating the result
> |  4. Return the result
> |
> | to a single syntactic element that, in my opinion, is quite readable.
>
> Does that already give you parallel processing?  That is the one element
> missing here and I was thinking that in order completely push Hadley over
> the
> C++ cliff I should introduce him to OpenMP :)
>
> The next real trick will be to get these things done transparently on all
> cores.
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20121120/19fb6a2e/attachment.html>


More information about the Rcpp-devel mailing list