|
|
Thinking inside the box | |||||
|
Bio
Code Linux Quantian About Blog
|
RInside 0.2.6
This release has an additional fix for the Windows use case, adds cmake support files for the examples, switches to using the same RNG initialization of time and process id that R uses, and other minor fixes. All changes since the last release are summarized below: CRANberries also provides a short report with changes from the previous release. More information is on the RInside page. Questions, comments etc should go to the rcpp-devel mailing list off the Rcpp R-Forge page.2012-01-11 Dirk Eddelbuettel /code/rinside | permanent link Fri, 30 Dec 2011
RcppExamples 0.1.3
The two ChangeLog entries since the last release are below. One new example
was added, and some things were changed in order to make Thanks to CRANberries, you can also look at a diff to the previous release 0.1.2. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Tue, 27 Dec 20112011-12-28 Dirk Eddelbuettel
Rcpp 0.9.9
The complete NEWS entry for 0.9.9; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, you can also look at a
diff to the previous release 0.9.8.
As always, even fuller details are on the
Rcpp Changelog page and the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
Thu, 22 Dec 2011
Rcpp 0.9.8
This release contains a few incremental changes.
Romain, sponsored by
by the Open Source Programs Office at Google, had released a new
package int64 bringing
larger integers to R, and this is now
supported by Rcpp
as well.
John Chambers contributed some code to have Reference Classes extend existing
C++ classes (typically brought in via Rcpp Modules).
Jelmer Ypma sent us a patch to add a The complete NEWS entry is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, you can also look at a
diff to the previous release 0.9.7.
As always, even fuller details are on the
Rcpp Changelog page and the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
Thu, 15 Dec 2011
R / Finance 2012 Call for Papers
So see you in Chicago in May! Update: Corrected urls to past conference thanks to heads-up by Josh. Thanks! Tue, 13 Dec 2011
RcppArmadillo 0.2.34
Courtesy of
CRANberries, there
is also a diffstat reports
for 0.2.34 relative to 0.2.33
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Thu, 08 Dec 2011
RInside 0.2.5
The big news for this release is that Windows applications once again run! James
Bates gets full credit for noticing why Windows binaries died on startup,
and provided a short patch which we (after some further simplicifcation)
added. So for the first time since the 0.2.0 release, Windows users can just change
into the
The other main addition is a new examples directory
One minor snafu I just noticed is that I was overzealous with the
All changes since the last release are summarized below:
CRANberries also
provides a short report with
changes from the previous release.
More information is on the
RInside page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the Rcpp R-Forge page.
/code/rinside | permanent link
Rcpp talk at Seattle RUG
The slides are now up at the top of my presentations page. Wed, 07 Dec 2011
RcppArmadillo 0.2.33
Courtesy of
CRANberries, there
is also a diffstat reports
for 0.2.33 relative to 0.2.32
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Mon, 05 Dec 2011
RcppArmadillo 0.2.32
The NEWS entries summarising the changes since the 2.2.* series, we already saw most of this with the two prerelease 0.2.30 and 0.2.31:
Courtesy of
CRANberries, there
is also a diffstat reports
for 0.2.32 relative to 0.2.31
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Wed, 30 Nov 2011
Wicked Webapps with R, err, Wt
The example was simple yet powerful: a reimplementation of the standard GUI application of a standard density estimate. Here the user can pick a kernel density function from a selection, and also slide a bandwidth parameter. One nice addition was an entry field already populated with a simple expression for a mixture of Normals, allowing for arbitrary random distributions over which to estimate. The example is pretty (thanks to Qt), and was added to RInside with the last CRAN release 0.2.4. The blog post has a nice screenshot. I had long wondered how to do something similar 'on the web'. Web integration and application frameworks are of course a dime a dozen: Just about any language offers this, with more or less ease. But I wanted something simple yet powerful and fast. And I did not like the idea of a multi-tier app, or of a multi-language mix. I remember having seen something about a web-application framework not unlike Qt, and studying the very useful Wikipedia web application framework comparison I re-discovered Wt (pronounced "Witty"). So there it is, using C++ which brings us ample performance, the ability to connect to a number of libraries and applications (which is important in my quantitatively-minded workd) and avoid the whole multi-tier, multi-language combination. The Wt website has a few more good reason why this may be a suitable idea; the toolkit also offers a very decent amount of features and is amply documented with a fair number of examples. And after just a little bit poking around during two weekends, I now have the following webapp committed in the SVN repository of RInside, and it is all implemented in in less than two hundred (generously commented) lines of code.
It is currently up and running at the address shown in the screenshot, so give it a go (though I may take it down at another point in time). I quite like it: The application is responsive: changes in the radio buttons (for the density), or the bandwidth, each trigger reestimation of the density, and a new and updated chart is displayed immediately with no noticeable delay---just like the desktop application did. Best of all, the code logic is essentially unchanged from the Qt-based app. Signals and slots related events to actions, the layout is in terms of standard GUI boxen and containers. And best of all, I did not have to write a line of html, javascript, css or ajax: it is all handled by the Wt toolkit. I was able to drive the app from an Android phone, my tablet, various computers around the house, and had a few friends poke a stick at it from afar. There is at one open issue. Wt launches new instances of the application object with each connection, which is a very clean model. That doesn't map perfectly with R (which is single-threaded) and RInside (which runs as a singleton for the same reason). So right now, each action sends its state back to the client. In other words, each clients own its parameters and well as vector of random numbers. Each new action sends these back to the app which passes it to R, launches the re-estimation and gets an updated chart back which is then shown by the the client. That is not perfect, and maybe a forking model as used by Simon's RServe would be better, though it would require a rewrite of RInside. Not sure if we get there anytime soon. And for simple applications not facing legions of concurrent users, the singleton should still work. It's a proof of concept at this point. Feedback welcome, and RInside and Rcpp questions should go to the rcpp-devel list as usual. /code/snippets | permanent link Tue, 29 Nov 2011
RcppArmadillo 0.2.31
The NEWS entries summarising the changes for both are below:
Courtesy of
CRANberries, there
is also a diffstat reports
for 0.2.31 relative to 0.2.30
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Sun, 27 Nov 2011
A Story of Life and Death. On CRAN. With Packages.
The success of CRAN is due to a lot of hard work by the CRAN maintainers, lead for many years and still today by Kurt Hornik whose dedication is unparalleled. Even at the current growth rate of several packages a day, all submissions are still rigorously quality-controlled using strong testing features available in the R system. And for all its successes, and without trying to sound ungrateful, there have always been some things missing at CRAN. It has always been difficult to keep a handle on the rapidly growing archive. Task Views for particular fields, edited by volunteers with specific domain knowledge (including yours truly) help somewhat, but still cannot keep up with the flow. What is missing are regular updates on packages. What is also missing is a better review and voting system (and while Hadley Wickham mentored a Google Summer of Code student to write CRANtastic, it seems fair to say that this subproject didn't exactly take off either).
Following useR! 2007 in Ames, I decided to do something and noodled over a first design on the drive back to Chicago. A weekend of hacking
lead to CRANberries. CRANberries uses existing R functions to learn which packages
are available right now, and compares that to data stored in a local SQLite database. This is enough to learn two things: First, which
new packages were added since the last run. That is very useful information, and it feeds a website with blog
subscriptions (for the technically minded: an RSS feed, at this URL).
Second, it can also compare current versions numbers with the most recent stored
version number, and thereby learns about updated packages. This too is useful, and also feeds a website and RSS
stream (at this URL; there is also a combined one for new and updated packages.) CRANberries
writes out little summaries for both new packages (essentially copying what the DESCRIPTION file contains), and a quick
All this has been operating since 2007. Google Reader tells me the the RSS feed averages around 137 posts per week, and has about 160 subscribers. It does feed to Planet R which itself redistributes so it is hard to estimate the absolute number of readers. My weblogs also indicate a steady number of visits to the html versions.
The most recent innovation was to add tweeting earlier in 2011 under the Which leads us to today's innovation. One feature which has truly been missing from CRAN was updates about withdrawn packages. Packages can be withdrawn for a number of reasons. Back in the day, CRAN carried so-called bundles carrying packages inside. Examples were VR and gregmisc. Both had long been split into their component packages, making VR and gregmisc part of the set of packages no longer on the top page of CRAN, but only its archive section. Other examples are packages such as Design, which its author Frank Harrell renamed to rms to match to title of the book covering its methodology. And then there are of course package for which the maintainer disappeared, or lost interest, or was unable to keep up with quality requirements imposed by CRAN. All these packages are of course still in the Archive section of CRAN. But how many packages did disappear? Well, compared to the information accumulated by CRANberries over the years, as of today a staggering 282 packages have been withdrawn for various reasons. And at least I would like to know more regularly when this happens, if only so I have a chance to see if the retired package is one the 120+ packages I still look after for Debian (as happened recently with two Rmetrics packages).
So starting with the next scheduled run, CRANberries
will also report removed packages, in its own subtree of the website and its own RSS feed (which should appear at
this URL). I made the required code changes (all of about two
dozen lines), and did some light testing. To not overwhelm us all with line noise while we catch up to the current steady state of packages, I
have (temporarily) lowered the frequency with which CRANberries is called by
I hope this is of interest and use to others. If so, please use the RSS feeds in your RSS readers, and subscribe to the
/code/cranberries | permanent link Mon, 21 Nov 2011
RPostgreSQL 0.2-0, 0.2-1 and an unsung Open Source hero
Fast-forward a few years. A caretaker group had maintained the package in the meantime, but without really writing any new code. But thanks to the tireless efforts of Tomoaki Nishiyama, who not only wrote a lot of new code addressing some of issues logged at the Google Code project page, but also stepped forward and became the new lead maintainer, things are much, much better now.
The first 0.2-0 release a few weeks ago already addressed a rather large number of issues,
bringing the feature set much closer to what one would expect from a feature-complete
package. But one big thorn remained: builds on Windows still required a
local PostgreSQL library installation as well as local compilation. And as we
can tell from the mailing list(s), this is a little daunting for many
potential users. But what did release 0.2-1 bring: a complete set of libpq
sources so that builds on Windows no longer require presence of local
PostgreSQL sources! We tested this using Uwe Ligges' excellent
win-builder service for R, and
after I reminded Uwe on the weekend to no longer blacklist build attempts of
RPostgreSQL, we
now have Windows binaries for direct installation. Just call
Tomoaki achieved this pretty much single-handedly, and for that reason he greatly deserves some extra praise as an unsung Open Source hero! /code/rpostgresql | permanent link Sun, 20 Nov 2011
RcppArmadillo 0.2.30 (and 0.2.29)
Armadillo is a wonderfully expressive (thanks to clever modern template programming), powerful yet simple-to-use C++ library for linear algebra, making expressions in C++ as easy as writing in Matlab or R. By deploying our seamless Rcpp glue between R and C++, RcppArmadillo brings this nice C++ library to R users. The CRAN page for RcppArmadillo now lists ten packages using the RcppArmadillo package. There was also an earlier bug-fix release 0.2.29 which I had not blogged about separately. The NEWS entries summarising the changes for both are below:
Courtesy of
CRANberries, there
are also diffstat reports
for 0.2.30 relative to 0.2.29
and
for 0.2.29 relative to 0.2.28.
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Sun, 06 Nov 2011
Rcpp talk at Seattle RUG next month
So if you can make it to the Thomas building of the Fred Hutchinson Cancer Research Center in Seattle, WA, on December 7, I would love to see you there. I have some ideas about freshening up the presentation(s) based on material Romain and I have used in the past. This should make the why as well as how a little clearer; now I just have to find some to put this together. And if there are particular aspects you would like to see covered, please do get in touch with me. Sun, 23 Oct 2011
Kurt Elling and the Klüvers Big Band at the Green Mill
Now this requires some context. Earlier in the year, I had tweeted briefly about a Kurt Elling live concert still streaming on NPR, and truth be told, I have listened to Kurt Elling a whole lot ever since. The most recent album The Gate is fantastic, the Grammy-winner Dedicated to You (which retakes the very famous Coltrane/Hartman album) is beyond words, and The Messenger is worth it just for 'Nature Boy' and the funkiest-ever 'April in Paris'. I also saw him as part of a larger and otherwise rather neat tour. But I needed to see the man himself. So following what one can see from his touring calendar, I jotted down two October dates. Kurt Elling at the Green Mill. Fine. That was earlier in the summer. Summer has a tendency of evaporating quickly, so here we were in October. And getting going late on Friday, so by the time we got the Green Mill, a long line had formed and we ended up paying tribute to the line for fourty-five minutes with nothing to show. Sad. Home we went, and no live music. But somehow we mustered the energy to go again last night and thought we were early, arriving about 20 minutes before the show was to start. Ha! Others had appeared at 3pm, by 5pm all seats were gone. We were literally the last ones the get in after a short spell in a shorter line, and standing room-only it was. Oh, but what a treat we got. The set for these two days was Kurt Elling with the fourteen piece Klüvers Big Band from Denmark. They played for three marvellous sets, and well over four hours (with two 25 minute breaks). Pieces often alternated between big band arrangements and smaller pieces by Elling's standard rhythm band, and covered standards as well as Elling's catalogue. As I mentioned earlier on a short post (with pictures) on Google+, it is essentially impossible to not fall for Elling's stage presence when being so close to the stage. The man is just that good. Elling and the Klüvers Big Band will now play for six nights at Birdland in New York followed by a night each in Washington, DC, and Boston. If you're around, do yourself a favour and go out to see them. /music/jazz/live | permanent link Sat, 01 Oct 2011
Reminder: One week til Rcpp class in San Francisco
We are happy to report that the number of registrations has met our initial targets. But as a number of open slots remain, we have decided to offer a few places at discounts of 25% for academics (with code acad1) and 50% for students (with code student). Course details are at the Revolution course page, registration is at the Eventbrite page. And just for completeness, here is what I wrote in the previous announcement: The format will follow the workshop Romain and I gave during the tutorial day preceding this year's R/Finance conference. The style will once again be hands-on, with copious concrete examples and solid coverage of most aspects of Rcpp and related packages such as RInside, RcppArmadillo and others. The eight-hour schedule contains about six hours of instruction, split into four sessions of around ninety minutes. This leaves ample time for both lunch and coffee breaks, and for informal discussions and Q+A.Feel free to contact me at the usual email address with questions. Or with suggestions for the after-party in San Francisco :) Fri, 30 Sep 2011
Rcpp 0.9.7
This release contains two contributed fixes. The first, suggested by Darren Cook via the rcpp-devel mailing list, corrects how we had set up exceptions specifications, reflecting a bit of Java-think on our part. The idiom is generally discouraged in C++, and we now conform. The second came in two excellent patches by R Core member Martyn Plummer which finally get us compilation on Solaris. This is much appreciated as our hands were tied here for lack of access to such a box. Otherwise, two new examples and a new unit test were added. The complete NEWS entry is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, you can also look at a
diff to the previous release 0.9.6.
As always, even fuller details are on the
Rcpp Changelog page and the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
Wed, 21 Sep 2011
digest 0.5.1
Bryan Lewis, who is doing very stuff with websockets and Html5 as he demoed
last week the Chicago R User Group meeting, needed CRANberries provides the usual summary of changes to version 0.5.0. As usual, our package is available via the R-Forge page leading to svn and tarball access, my digest page and the local directory here. Sun, 18 Sep 2011
Fox Valley Marathon 2011
The race went well enough. I had been racing twice a year at this distance, but took a break after running with some minor injury and generally not too well (see e.g. my writeup from last year's Boston and Chicago marathons). So I wasn't even sure I'd run one this year at all, but the bug got me again when two friends signed up for this, and off we went to train over the summer. So with a few more miles from training, I was pretty antsy and went out too fast as usual, and paid with an as-usual slower half and few short walking breaks past mile 20. But I beat the hope-for target time of 3:25 quite handily with a 3:19:03 -- or a 7:36 min/mile pace. Which (as I noted in a quick post to Google+ started right after the race, and since edited/expanded -- prods to Google+) should hopefully get me back to Boston next spring. /sports/running | permanent link Sat, 17 Sep 2011
littler 0.1.5
So with apologies for the lower quality release, and the two hour malfuntioning window for
CRANberries
that it cause, a repaired version is now out there.
The very brief (upstream) 2011-09-17 Dirk Eddelbuettel
littler provides As usual, our code is available via our svn archive or from tarballs off my littler page and the local directory here. A fresh package is in Debian's incoming queue and will hit mirrors shortly. /code/littler | permanent link Thu, 15 Sep 2011
littler 0.1.4
With that, I did a little cleanup as it has been a while since
version 0.1.3.
The brief (upstream) 2011-09-15 Dirk Eddelbuettel
littler provides As usual, our code is available via our svn archive or from tarballs off my littler page and the local directory here. A fresh package is in Debian's incoming queue and will hit mirrors shortly. /code/littler | permanent link Mon, 12 Sep 2011
RQuantLib 0.3.8
Thanks to Helmut Heiming who noticed a side-effec t from the
Thanks to CRANberries, there is also a diff to the previous release 0.3.7. Full changelog details, examples and more details about this package are at my RQuantLib page. /code/rquantlib | permanent link Thu, 08 Sep 2011
Faster (recursive) function calls: Another quick Rcpp case study
This leads to very straightforward implementations using recursion: ## R implementation of recursive Fibonacci sequence fibR <- function(n) { if (n == 0) return(0) if (n == 1) return(1) return (fibR(n - 1) + fibR(n - 2)) } Unfortunately, this elegant implementation which remain close to the abtract formulation of the recurrence algorithm performs very poorly in R as there is noticeable overhead in function calls which becomes dominant in a recursion. This lead to the original question on StackOverflow, and the accepted answer uses a trick presented by Pat Burns in his lovely R Inferno: rewrite the solution using a computer science trick called memoization: fibonacci <- local({ memo <- c(1, 1, rep(NA, 100)) f <- function(x) { if(x == 0) return(0) if(x < 0) return(NA) if(x > length(memo)) stop("'x' too big for implementation") if(!is.na(memo[x])) return(memo[x]) ans <- f(x-2) + f(x-1) memo[x] <<- ans ans } }) That is a fair answer, and even more was suggested with a link to a terrific analysis calling the Fibonacci recurrence the worst algorithm in the world. That is also fair, but all the basic research into better algorithms exploiting some structure of the problem to advance performance (and of course understanding) is overlooking one crucial part: algorithm analysis is essentially independent of the language. So whatever improvements we obtain by thinking really hard about a problem are then available for other implementations too. So with a tip of the hat to the old Larry Wall quote about Lazyness, Impatience and Hubris, I would like to suggest what I consider a much simpler route to much better performance: recode it in C++ using both Rcpp (for the R/C++ integration) and inline for the on-the-fly compilation, linking and loading of C++ code into R. ## inline to compile, load and link the C++ code require(inline) ## we need a pure C/C++ function as the generated function ## will have a random identifier at the C++ level preventing ## us from direct recursive calls incltxt <- ' int fibonacci(const int x) { if (x == 0) return(0); if (x == 1) return(1); return (fibonacci(x - 1)) + fibonacci(x - 2); }' ## now use the snippet above as well as one argument conversion ## in as well as out to provide Fibonacci numbers via C++ fibRcpp <- cxxfunction(signature(xs="int"), plugin="Rcpp", incl=incltxt, body =' int x = Rcpp::as<int>(xs); return Rcpp::wrap( fibonacci(x) ); ') This single R function call
A performance comparison of the basic R version So the recursion for the original argument of N=35 takes just over a minute at about 61.5 and 61.9 seconds, respectively, for the R version and its byte-compiled variant (as per the column titled elapsed). So byte-compilation essentially offers no help for the bottleneck of slow function calls.edd@max:~/svn/rcpp/pkg/Rcpp/inst/examples/Misc$ r fibonacci.r Loading required package: inline Loading required package: methods Loading required package: compiler test replications elapsed relative user.self sys.self 3 fibRcpp(N) 1 0.092 1.0000 0.09 0.00 2 fibRC(N) 1 61.480 668.2609 61.47 0.00 1 fibR(N) 1 61.877 672.5761 61.83 0.02 edd@max:~/svn/rcpp/pkg/Rcpp/inst/examples/Misc$
The C++ versions relying on Rcpp which created in a few lines of code and a
single call to That provides another nice demonstration of what Rcpp can do. Improved algorithms for well-understood problems are surely one way to accelerate solutions. But there are (many ?) times when we do not have the luxury of being able to think through to a new and improved approach. Or worse, such an approach may even introduce new errors or inaccurracies if we get it wrong on a first try. With Rcpp, we are able to the express the problem as written in its original statement: a simple recursion. The gain relative to a slow R implementation is noteworthy---and could of course be improved further if we really needed to by relying on better algorithms like memoization. But for day to day tasks, I gladly take speedups of (up to) a few hundred times thanks to Rcpp without having to do hard algorithmic work. Before closing, a quick reminder that I will be giving two classes on Rcpp in a few weeks. These will be in New York on September 24, and San Franciso on October 8, see this blog post as well as this page at Revolution Analytics (who are a co-organiser of the classes) for details and registration information. Tue, 23 Aug 2011
Accelerating path-dependent loops: A quick Rcpp case study
By the time I saw that question yesterday evening, Josh Ulrich had already posted a nice answer suggesting
to switch from
Let's start with the general setup, and the two functions supplied by Josh. We also byte-compile these using the library(inline) library(rbenchmark) library(compiler) fun1 <- function(z) { for(i in 2:NROW(z)) { z[i] <- ifelse(z[i-1]==1, 1, 0) } z } fun1c <- cmpfun(fun1) fun2 <- function(z) { for(i in 2:NROW(z)) { z[i] <- if(z[i-1]==1) 1 else 0 } z } fun2c <- cmpfun(fun2)
We see that basic worker just assign to the i-th element based on the preceding element. Function two uses the aforementioned
Writing the same code in C++ using both Rcpp (for the R/C++ integration) and inline for the on-the-fly compilation, linking and loading of C++ code into R is pretty straightforward too: funRcpp <- cxxfunction(signature(zs="numeric"), plugin="Rcpp", body=" Rcpp::NumericVector z = Rcpp::NumericVector(zs); int n = z.size(); for (int i=1; i<n; i++) { z[i] = (z[i-1]==1.0 ? 1.0 : 0.0); } return(z); ")
This single R function call takes the code embedded in the argument to the R> z <- rep(c(1,1,0,0,0,0), 100) R> identical(fun1(z),fun2(z),fun1c(z),fun2c(z),funRcpp(z)) [1] TRUE R> R> res <- benchmark(fun1(z), fun2(z), + fun1c(z), fun2c(z), + funRcpp(z), + columns=c("test", "replications", "elapsed", "relative", "user.self", "sys.self"), + order="relative", + replications=1000) R> print(res) test replications elapsed relative user.self sys.self 5 funRcpp(z) 1000 0.005 1.0 0.01 0 4 fun2c(z) 1000 0.482 96.4 0.48 0 2 fun2(z) 1000 1.989 397.8 1.98 0 3 fun1c(z) 1000 11.365 2273.0 11.37 0 1 fun1(z) 1000 13.210 2642.0 13.21 0 We can focus on the columns labelled elapsed and relative. The C++ version is faster by a factor of almost one-hundred compared to the byte-compiled version of funtion2, and almost four-hundred times faster than the plain-R variant of function2. And function1 is even worse, coming at well over twenty-two-hundred times the run-time of the C++ version. Byte-compilation also helps little here. For comparison, we also ran the original example of a very short vector, called more frequently: The qualitative ranking is unchanged: the Rcpp version dominates. Function2 usingR> z <- c(1,1,0,0,0,0) R> res2 <- benchmark(fun1(z), fun2(z), + fun1c(z), fun2c(z), + funRcpp(z), + columns=c("test", "replications", "elapsed", "relative", "user.self", "sys.self"), + order="relative", + replications=10000) R> print(res2) test replications elapsed relative user.self sys.self 5 funRcpp(z) 10000 0.047 1.00000 0.04 0 4 fun2c(z) 10000 0.134 2.85106 0.13 0 2 fun2(z) 10000 0.328 6.97872 0.32 0 3 fun1c(z) 10000 1.080 22.97872 1.08 0 1 fun1(z) 10000 1.243 26.44681 1.24 0 if instead of the vectorised ifelse is second-best with the byte-compiled version being about twice as fast that the plain R
variant, but still almost three times slower than the C++ version. And the relative differences are less pronounced: relatively speaking, the
function call overhead matters less here and the actual looping matters more: C++ gets a bigger advantage on the actual loop operations in the longer
vectors. That it is an important result as it suggests that on more real-life sized data, the compiled version may reap a larger benefit.
All in all a nice demonstration of Rcpp, and a gain of almost one-hundred to the best byte-compiled version is nothing to sneeze at---especially when it is so easy to write and load a five-line C++ function thanks to Rcpp. Before closing, a quick reminder that I will giving two classes on Rcpp in a few weeks. These will be in New York on September 24, and San Franciso on October 8, see this blog post as well as this page at Revolution Analytics (who are a co-organiser of the classes) for details and registration information. Thu, 04 Aug 2011
New Rcpp master classes scheduled for New York and San Francisco
The format will follow the workshop Romain and I gave during the tutorial day preceding this year's R/Finance conference. The style will once again be hands-on, with copious concrete examples and solid coverage of most aspects of Rcpp and related packages such as RInside, RcppArmadillo and others. The eight-hour schedule contains about six hours of instruction, split into four sessions of around ninety minutes. This leaves ample time for both lunch and coffee breaks, and for informal discussions and Q+A. Two one-day classes will be offered: The first in New York on Saturday, September 28, 2011 and the second one two weeks later in San Franciso on Saturday, October 8, 2011. Please see the official course page for more details, concrete location info and maps as well as registration details. Feel free to contact me at the usual email address with questions. Tue, 02 Aug 2011
RcppArmadillo 0.2.28
The NEWS entry is below; a number of these changes were already in the preceding 0.2.27 release of RcppArmadillo which was base on the beta for Armadillo 2.2.0.
CRANberries provides
a diffstat report
for 0.2.28 relative to 0.2.27.
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Wed, 27 Jul 2011
Rcpp 0.9.6
This release contains a fix which helps the RppEigen package (mentioned previously on this blog), as well as an addition which permits user-defined finalizers for external pointer objects (following a suggestion on the mailing list). Two new examples where added: a Gibbs sampler illustration (blogged about as well) and a Rcpp-based Fibonacci implementation following a question on StackOverflow. And while that last example is clearly degenerate, the 700+ fold net speedup (as shown in my answer) is still pretty neat. The complete NEWS entry is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, you can also look at a
diff to the previous release 0.9.5.
As always, even fuller details are on the
Rcpp Changelog page and the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
Sat, 23 Jul 2011
RcppArmadillo 0.2.26 and 0.2.27
Conrad did not rest either and just yesterday released version 2.1.91 as a first step towards a new 2.2.0 release sometime soon. And also yesterday, we wrapped that new version into RcppArmadillo release 0.2.27. With CRAN being back in full swing, we pushed it over there this morning and it already made its way into the repository. The NEWS entries summarising the changes---which are exclusively upstream---are below:
Courtesy of
CRANberries, there
are also diffstat reports
for 0.2.27 relative to 0.2.26
and
for 0.2.26 relative to 0.2.25.
As always, more detailed information is on the
RcppArmadillo page.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page.
Thu, 14 Jul 2011
MCMC and faster Gibbs Sampling using Rcpp
The example is based on a blog post by Darren Wilkinson which itself discusses and compares the suitability of R, Python, Java or C for MCMC analysis, using the Gibbs sampler as a concrete example. Darren's post is worth checking out: he stresses the rather pragmatic aspects of how fast and/or easy it is to write the code, rather than just the mere runtime. As such, he is not too concerned with a speed advantage of Python over R which he sees at a factor of around 2.4, leaving him to continue to prototype in R. Similarly, with C 'only' being faster than Java by a factor of two, he prefers Java for the numerically more demanding parts. We do of course advocate the use of Rcpp to combine the best aspects of R and C++, respectively. This Gibbs sampler example provides a nice backdrop. So working with Darren's example, consider the same Gibbs sampler for a bivariate distribution (and apologies for the lack of latex typesetting on my blog) where the conditional distributions aref(x,y) = k x^2 exp( -x y^2 - y^2 + 2y - 4x) Sanjog then spotted and corrected a small error in the variance expression in Darren's derivation; this is now acknowledged on Darren's website. Full details are in the R script now committed in SVN. The R code for the Gibbs sample can therefore be written as follows below. Note that this uses thinning to minimize serial correlation in the conditional densities--which renders the computation more demanding as 'N times thin' draws have to be generated:f(x|y) = (x^2)*exp(-x*(4+y*y)) ## a Gamma density kernel f(y|x) = exp(-0.5*2*(x+1)*(y^2 - 2*y/(x+1)) ## a Gaussian kernel A second variant can be computed using the R bytecode compiler which appeared with the recent release of R 2.13.0 (and which we analysed in this blog post from April). This is as easy as## Here is the actual Gibbs Sampler ## This is Darren Wilkinsons R code (with the corrected variance) ## But we are returning only his columns 2 and 3 as the 1:N sequence ## is never used below Rgibbs <- function(N,thin) { mat <- matrix(0,ncol=2,nrow=N) x <- 0 y <- 0 for (i in 1:N) { for (j in 1:thin) { x <- rgamma(1,3,y*y+4) y <- rnorm(1,1/(x+1),1/sqrt(2*(x+1))) } mat[i,] <- c(x,y) } mat } Thanks to Rcpp and the inline package, we can also write a C++ variant that can be built and launched from R with ease. The C++ code is assigned to an R text variable## We can also try the R compiler on this R function RCgibbs <- cmpfun(Rgibbs) gibbscode. (And we used to typeset such
code on the blog as a character string, ie in a faint red color---but have now switched to highlight it as if it were freestanding C++
code. It really is passed as a single string to R which then uses the cxxfunction() to compile, link and load a C++ function
built around the code. See previous posts on the inline package for more.)
It is noteworthy how the code logic is essentially identical between the basic R version, and the C++ version. Two nested loops control draws of x from a Gamma distribution, conditional on y, as well as draws of y from a Normal, conditional on x. Add a small amount of parameter passing to obtain the parameters## Now for the Rcpp version -- Notice how easy it is to code up! gibbscode <- ' using namespace Rcpp; // inline does that for us already // n and thin are SEXPs which the Rcpp::as function maps to C++ vars int N = as<int>(n); int thn = as<int>(thin); int i,j; NumericMatrix mat(N, 2); RNGScope scope; // Initialize Random number generator // The rest of the code follows the R version double x=0, y=0; for (i=0; i<N; i++) { for (j=0; j<thn; j++) { x = ::Rf_rgamma(3.0,1.0/(y*y+4)); y = ::Rf_rnorm(1.0/(x+1),1.0/sqrt(2*x+2)); } mat(i,0) = x; mat(i,1) = y; } return mat; // Return to R ' # Compile and Load RcppGibbs <- cxxfunction(signature(n="int", thin = "int"), gibbscode, plugin="Rcpp") N and thin, allocation of a results matrix and setup of the random number generator state
to remain consistent with R, as well as a return of the matrix---and that is all.
As Darren's code uses the GNU GSL in its C variant, I also became interested in seeing how a C/C++ hybrid variant using our RcppGSL package would fare. The code is below. This code is similar to the version using just Rcpp, but we need to allocate space for the GSL random generator object (and later release that memory allocation), and we do of course call the GSL functions. This also necessitates declaring the function using the two header files listed as arguments for thegslgibbsincl <- ' #include <gsl/gsl_rng.h> #include <gsl/gsl_randist.h> using namespace Rcpp; // just to be explicit ' gslgibbscode <- ' int N = as<int>(ns); int thin = as<int>(thns); int i, j; gsl_rng *r = gsl_rng_alloc(gsl_rng_mt19937); double x=0, y=0; NumericMatrix mat(N, 2); for (i=0; i<N; i++) { for (j=0; j<thin; j++) { x = gsl_ran_gamma(r,3.0,1.0/(y*y+4)); y = 1.0/(x+1)+gsl_ran_gaussian(r,1.0/sqrt(2*x+2)); } mat(i,0) = x; mat(i,1) = y; } gsl_rng_free(r); return mat; // Return to R ' ## Compile and Load GSLGibbs <- cxxfunction(signature(ns="int", thns = "int"), body=gslgibbscode, includes=gslgibbsincl, plugin="RcppGSL") include argument of
cxxfunction().
So how is the performance?
The script (now committed in Rcpp's SVN repo as
The first block is a hand-computed comparison using four sets of parameters; the second block uses the excellent rbenchmark package to
compare ten runs at twenty-thousand draws.
We see a nominal increase in performance due to the bytecode compiler, saving roughly 38 percent which seems appropriate given that the R code mostly controls the loops; actual work in undertaken in the already compiled RNG functions. The Rcpp variant is about 34 times faster than the pure R code. Sanjog reported higher increases on his OS X machines (and Darren's post echos a similar order of magnitude). However, on my i7 running Linux I always obtained an improvement in the mid- to high thirties. That is certainly already a rather pleasant result.
What surprised and stunned me at first was that the GSL solution scores an improvement of around 53 times (close to the factor of 60
reported by Darren). A closer look at the code (shown above) makes it clear that there are very few compute-intensive operations outside of
the RNG draws. I validated this further with a second study timing just one million draws each from a Gaussian and Gamma using R via Rcpp,
and using the GSL. It turns out that the R code is about 2.5 times slower for random draws from the Gamma distribution than the GSL. Inspection of the
source code---in files So to sum up: Gibbs sampling is a somewhat resource-heavy Monte Carlo Markov Chain method for investigating multivariate distributions. R excels at quick and simple explorations, albeit at somewhat slower execution speed. The Rcpp package can help by providing easy means to accelerate simulations by a significant factor. The example discussed here is now in SVN repository for Rcpp and will be part of the next release. Updated 2011-07-16: Darren has just updated his comparison; fixed two typos here too. Wed, 06 Jul 2011
Rcpp 0.9.5
This release comprises a number of minor fixes, extensions as well as small additions to the documentation and examples which have accumulated since the last release in April. The complete NEWS entry is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, there is
also a
diff to the previous release 0.9.4:
ChangeLog | 74 DESCRIPTION | 10 R/00_classes.R | 3 R/Module.R | 16 R/loadRcppModules.R | 10 R/populate.R | 10 R/tools.R | 13 R/zzz.R | 3 cleanup | 2 inst/NEWS | 21 inst/doc/Rcpp-FAQ.pdf |binary inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw | 62 inst/doc/Rcpp-extending.pdf |binary inst/doc/Rcpp-introduction.pdf |binary inst/doc/Rcpp-modules.pdf |binary inst/doc/Rcpp-modules/Rcpp-modules.Rnw | 7 inst/doc/Rcpp-package.pdf |binary inst/doc/Rcpp-quickref.pdf |binary inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw | 59 inst/doc/Rcpp-sugar.pdf |binary inst/doc/Rcpp-unitTests.pdf |binary inst/doc/Rcpp.bib | 4 inst/doc/unitTests-results/Rcpp-unitTests.html | 18 inst/doc/unitTests-results/Rcpp-unitTests.txt | 49 inst/examples/OpenMP |only inst/include/Rcpp/Module.h | 33 inst/include/Rcpp/config.h | 2 inst/include/Rcpp/internal/wrap.h | 5 inst/include/Rcpp/module/Module_generated_CppMethod.h | 2902 +++++++++++++++++- inst/include/Rcpp/stats/random/rlnorm.h | 14 inst/include/Rcpp/stats/random/rnorm.h | 4 inst/include/Rcpp/sugar/functions/functions.h | 3 inst/include/Rcpp/sugar/functions/mean.h |only inst/include/Rcpp/sugar/functions/sd.h |only inst/include/Rcpp/sugar/functions/sum.h | 4 inst/include/Rcpp/sugar/functions/var.h |only inst/include/Rcpp/vector/Vector.h | 4 inst/skeleton/zzz.R | 1 inst/unitTests/runit.wrap.R | 25 man/CppClass-class.Rd | 2 man/loadRcppModules.Rd | 6 src/Module.cpp | 1 42 files changed, 3252 insertions(+), 115 deletions(-) As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Tue, 05 Jul 2011
Even faster linear model fits with R using RcppEigen
My talks introducing High Performance Computing with R (see e.g. these slides from a five-hour workshop at the ISM in Tokyo) frequently feature an example of how to extend R with dedicated compiled code for linear regressions. Romain and I also frequently use this a motivating examples with our Rcpp package for seamless R and C++ integration. In fact, the examples directory for Rcpp still contains an earlier version of a benchmark for fastLm(), a faster alternative for R's lm() and lm.fit() functions. We have also extended this with the RcppArmadillo package which brings Conrad Sanderson's excellent Armadillo library with templated C++ code for linear algebra to R, as well as a simple integration to the GNU GSL via our RcppGSL package. The Rcpp section on my blog contains several posts about fastLm benchmarks. Doug Bates has been a key Rcpp contributor, helping particularly with the initial Armadillo integration. His research, however, also requires highly performing sparse matrix operations which Armadillo does not yet offer. So Doug has started to explore the Eigen project---a free C++ template math library mainly focused on vectors, matrices, and linear algebra (note that we will refer to the Eigen, Eigen2 and Eigen3 APIs as just 'Eigen' here, focusing on the latest version, Eigen3). Better still, Doug went to work and pretty much single-handedly wrote a new package RcppEigen which integrates the templated C++ library Eigen with R using Rcpp. RcppEigen also provides a fastLm implementation and benchmark script. In fact, it contains a full six different implementations as Doug is keenly interested in rank-revealing decompositions which can guard against ill-conditioned model matrices. Some more background information on this is also available in Doug's article on Least Squares Calculations in R in R News 4(1). Doug's implementation also uses an elegant design. It comprises a base class with common functionality, and six subclasses which specialize accordingly for these six different decompositions approaches:
On my server, the result of running the included benchmark script lmBenchmark is as follows:
From this first set of results, the preferred method may be 'PivQR', the
pivoted QR. Strictly-speaking, it is the only one we can compare to
lm.fit() which also uses a pivoting scheme. In the case of a degenerated model matrix,
all the other methods, including the four fastest approaches, are
susceptible to producing incorrect estimates. Doug plans to
make SVD and SymmEig rank-revealing too.
As for pure speed, the LL and LDL decomposition have almost identical performance, and are clearly faster than the other approaches. Compared to lm.fit(), which is the best one could do with just R, we see an improvement by a factor of eight which is quite impressive (albeit not robust to rank-deficient model matrices). Apart from the SVD, all approaches using Eigen are faster than the one using Armadillo, which itself is still faster than R's lm.fit(). Doug and I were very surprised by the poor performance of the GNU GSL (which also uses SVD) via RcppGSL.
Now, Eigen uses its own code for all linear algebra operations, bypassing BLAS and LAPACK libraries. The results above were achieved with the current Atlas package in Ubuntu. If we take advantage of the BLAS / LAPACK plug-in architecture offered on Debian / Ubuntu systems (see the vignette in my gcbd package for more) and use Goto BLAS which provide tuning as well as parallelism on multi-core machines, the results are as follow:
We see that the BLAS-using Armadillo approach improves a little and moves
just slightly ahead of the pivoted QR. On the other hand, lm.fit(), which also
uses a pivoting scheme and hence only level 1 BLAS operations, changes less.
GSL performs even worse (and it is unclear why).
Doug's post announcing RcppEigen on the Eigen list has a few more sets of results.
This post has illustrated some of the performance gains that can be obtained from using Eigen via RcppEigen. When not using rank-revealing methods, computing time can be reduced by up to eight times relative to lm.fit(). Rank-revealing method can still improve by almost a factor of two. The main disadvantage of Eigen may be one of the reasons behind its impressive performance: its heavily templated code does not use BLAS, and the resulting object code (as e.g. in RcppEigen) becomes enormous (when compiling with debugging symbols). As one illustration, the shared library for RcppEigen on my Ubuntu 64-bit system has a size of 24.6 mb whereas RcppArmadillo comes in at a mere 0.78 mb; without debugging symbols it is a more reasonable 0.52 mb. The performance of Eigen is certainly intriguiging, and its API is rather complete. It seems safe to say that we may see more R projects going to make use of Eigen thanks to the RcppEigen wrapper. Update: Clarified statement about large object size which was entirely due to building with debugging support. Fri, 01 Jul 2011
RcppArmadillo 0.2.25
The NEWS file entries for both releases follow below; they include the aggregate changes some of which were already provided by the pre-releases leading up to Armadillo 2.0.0.
Courtesy of
CRANberries, here is the
diff to the previous release.
ChangeLog | 12 +++++ DESCRIPTION | 10 ++-- inst/NEWS | 36 +++++++++++++++- inst/include/armadillo_bits/arma_version.hpp | 10 ++-- inst/include/armadillo_bits/auxlib_meat.hpp | 4 - inst/include/armadillo_bits/diagmat_proxy.hpp | 4 - inst/include/armadillo_bits/fn_misc.hpp | 58 ++++++++++++++------------ inst/include/armadillo_bits/fn_princomp.hpp | 31 +++++++++++++ inst/include/armadillo_bits/subview_meat.hpp | 2 9 files changed, 126 insertions(+), 41 deletions(-) More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Fri, 24 Jun 2011
RcppArmadillo 0.2.23
A minor internal change was the rearrangement of arguments for the (mostly internal) function The short NEWS file extract follows below. I also include the entry for the bugfix release 0.2.22 (based on Armadillo 1.99.4) which preceded it, and which does not seem to have gotten its own blog post.
Courtesy of
CRANberries, here is
the
diff to the previous release.
RcppArmadillo-0.2.22/RcppArmadillo/inst/include/armadillo_bits/fn_princomp_cov.hpp |only RcppArmadillo-0.2.22/RcppArmadillo/inst/include/armadillo_bits/op_princomp_cov_bones.hpp |only RcppArmadillo-0.2.22/RcppArmadillo/inst/include/armadillo_bits/op_princomp_cov_meat.hpp |only RcppArmadillo-0.2.23/RcppArmadillo/ChangeLog | 21 RcppArmadillo-0.2.23/RcppArmadillo/DESCRIPTION | 10 RcppArmadillo-0.2.23/RcppArmadillo/NAMESPACE | 14 RcppArmadillo-0.2.23/RcppArmadillo/R/fastLm.R | 22 RcppArmadillo-0.2.23/RcppArmadillo/inst/NEWS | 22 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo | 3 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp | 12 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp | 2 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp | 150 +++- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp | 4 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp | 15 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp | 352 +++++----- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/config.hpp | 8 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/debug.hpp | 224 ++++-- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/diskio_bones.hpp | 12 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp | 301 +++++++- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/field_meat.hpp | 18 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_chol.hpp | 30 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_eig.hpp | 84 +- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp | 36 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_log_det.hpp | 10 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_lu.hpp | 33 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_misc.hpp | 12 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_pinv.hpp | 33 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_princomp.hpp | 49 + RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_qr.hpp | 11 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_rank.hpp | 13 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_solve.hpp | 13 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_svd.hpp | 25 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/fn_syl_lyap.hpp | 18 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp | 3 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp | 71 +- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/glue_solve_meat.hpp | 13 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/lapack_bones.hpp | 95 ++ RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_chol_meat.hpp | 6 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp | 6 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp | 39 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_max_meat.hpp | 50 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_median_meat.hpp | 115 +-- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_min_meat.hpp | 50 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_misc_bones.hpp | 14 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_misc_meat.hpp | 46 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_pinv_meat.hpp | 39 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_princomp_bones.hpp | 20 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_princomp_meat.hpp | 248 ++----- RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_prod_meat.hpp | 34 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_stddev_meat.hpp | 38 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_sum_meat.hpp | 36 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/op_var_meat.hpp | 38 - RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp | 4 RcppArmadillo-0.2.23/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_meat.hpp | 4 RcppArmadillo-0.2.23/RcppArmadillo/inst/unitTests/runit.fastLm.R | 8 RcppArmadillo-0.2.23/RcppArmadillo/man/fastLm.Rd | 32 RcppArmadillo-0.2.23/RcppArmadillo/src/fastLm.cpp | 15 57 files changed, 1695 insertions(+), 886 deletions(-) More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Sat, 11 Jun 2011
United Sounds of America: New York
The New York evening was organized by pianist Bill Charlap (wikipedia) who also headlined and MC-ed the first set. Covering the birth of Jazz until early post-war bebop in chronological fashion, it was a pretty decent jazz set with a very nice band featuring Kenny Washington (dr), Peter Washington (b), Jeremy Pelt (tp), Jimmy Greene (ts) and Ken Peplowski (cl) --- and local favourite Kurt Elling (wikipedia) who was simply outstanding with the classic songbook material. Having seen him live once before a few years ago, I happened to listen a lot to Elling of late, following the random find of this stream from a live concert in February as well as his two most recent records, the Grammy-winning Dedicated to You (which retakes the wonderful Coltrane/Hartman album from 1963) and the simply amazing very recent The Gate (which you should go and buy right now). And I was not disappointed. He has a great four-octave-spanning baritone voice and great stage presence. The second set was dedicated to post-war folk and singer/songwriter material and organized by Suzanne Vega. That was neat too, if somewhat different in format and more like your standard (rock-ish) concert. Vega brought her own band featuring Gerry Leonard (g), Mike Visceglia (b), Graham Hawthorne (dr) along with guest appearances by Tom Paxton (g, vocals) and Richard Julian (g, vocals). Somehow Vega seems a little trapped in her own success in the 1980s and rehashed a lot of old hits. Nothing wrong that per se as it is good material (more on that below). Only during three encores did she provide new material which was ... excellent. So maybe some rebalancing towards new stuff was neat. Also nice was the additiona of four string players from the Chicago Symphony which had joined the band for a Simon and Garfunkel's song The Boxer. Oh, and of course seeing Vega perform Tom's Diner was nice, especially in such a fast and rocking version, even enhanced by the those strings. Just a few months ago I had gone over the passage from the original a-capella version of Tom's Diner to the various beat-box remixes which were then remixed by Vega in various live performances (e.g. videos of a capella, rockish, another rockish and beatboxish versions). Good fun, and it is nice to see she is playing along and enjoying it as well. All told, a really nice iniative by the CSO. If you're in Chicagoland, go and see some of the remaining shows. /music/jazz/live | permanent link Sun, 05 Jun 2011
Charles Lloyd and Zakir Hussain
It was evident how much joy Charles Lloyd still gets from performing live at his somewhat advanced age of 73. Surrounded by some extraordinary musicians, and clearly enjoying himself on stage. Great evening with wonderful jazz music from somewhere in between modern post-whatever, free, bop and hard bop, world music and everything else in between. I regret not having seen him earlier in life. Very much recommended. /music/jazz/live | permanent link Mon, 30 May 2011
digest 0.5.0
Thanks to a patch by Mario Frasca, digest now contains a
second (exported) function R> library(digest) R> example(hmac) hmacR> ## Standard RFC 2104 test vectors hmacR> current <- hmac('Jefe', 'what do ya want for nothing?', "md5") hmacR> target <- '750c783e6ab0b503eaa86e310a5db738' hmacR> stopifnot(identical(target, as.character(current))) hmacR> current <- hmac(rep(0x0b, 16), 'Hi There', "md5") hmacR> target <- '9294727a3638bb1c13f48ef8158bfc9d' hmacR> stopifnot(identical(target, as.character(current))) hmacR> current <- hmac(rep(0xaa, 16), rep(0xdd, 50), "md5") hmacR> target <- '56be34521d144c88dbb8c733f0e8b3f6' hmacR> stopifnot(identical(target, as.character(current))) hmacR> ## SHA1 tests inspired to the RFC 2104 and checked against the python hmacR> ## hmac implementation. hmacR> current <- hmac('Jefe', 'what do ya want for nothing?', "sha1") hmacR> target <- 'effcdf6ae5eb2fa2d27416d5f184df9c259a7c79' hmacR> stopifnot(identical(target, as.character(current))) hmacR> current <- hmac(rep(0x0b, 16), 'Hi There', "sha1") hmacR> target <- '675b0b3a1b4ddf4e124872da6c2f632bfed957e9' hmacR> stopifnot(identical(target, as.character(current))) hmacR> current <- hmac(rep(0xaa, 16), rep(0xdd, 50), "sha1") hmacR> target <- 'd730594d167e35d5956fd8003d0db3d3f46dc7bb' hmacR> stopifnot(identical(target, as.character(current))) R> Also, CRANberries shows the difference to the previsious release 0.4.2 as follows: Diff between digest versions 0.4.2 dated 2009-12-06 and 0.5.0 dated 2011-05-30 digest-0.4.2/digest/INDEX |only digest-0.4.2/digest/R/zzz.R |only digest-0.4.2/digest/inst |only digest-0.5.0/digest/ChangeLog |only digest-0.5.0/digest/DESCRIPTION | 33 ++++++++++++------------- digest-0.5.0/digest/NAMESPACE | 7 +++-- digest-0.5.0/digest/R/hmac.R |only digest-0.5.0/digest/man/hmac.Rd |only digest-0.5.0/digest/tests/digestTest.Rout.save | 2 - digest-0.5.0/digest/tests/hmacTest.R |only digest-0.5.0/digest/tests/hmacTest.Rout.save |only 11 files changed, 22 insertions(+), 20 deletions(-)
With that, special thanks to Mario Frasca for the patch and to Henrik Bengtsson for helpful discussion. We took some care to ensure that the
existing interface to the
Bike The Drive 2011
/sports/cycling | permanent link Sat, 28 May 2011
RcppArmadillo 0.2.21
The short NEWS file extract follows below.
And courtesy of
CRANberries, here is
the
diff to the previous release.
Diff between RcppArmadillo versions 0.2.20 dated 2011-05-26 and 0.2.21 dated 2011-05-28 ChangeLog | 8 DESCRIPTION | 8 inst/NEWS | 7 inst/include/armadillo | 2 inst/include/armadillo_bits/Col_meat.hpp | 13 - inst/include/armadillo_bits/Mat_bones.hpp | 2 inst/include/armadillo_bits/Mat_meat.hpp | 147 +++++++------- inst/include/armadillo_bits/Row_meat.hpp | 11 - inst/include/armadillo_bits/arma_version.hpp | 4 inst/include/armadillo_bits/diagview_bones.hpp | 2 inst/include/armadillo_bits/diagview_meat.hpp | 4 inst/include/armadillo_bits/diskio_meat.hpp | 40 ++-- inst/include/armadillo_bits/fn_accu.hpp | 167 ++++++++++------- inst/include/armadillo_bits/fn_det.hpp | 10 - inst/include/armadillo_bits/fn_prod.hpp | 15 + inst/include/armadillo_bits/op_dot_bones.hpp | 9 inst/include/armadillo_bits/op_dot_meat.hpp | 119 +++++++++--- inst/include/armadillo_bits/promote_type.hpp | 24 +- inst/include/armadillo_bits/running_stat_bones.hpp | 16 - inst/include/armadillo_bits/running_stat_meat.hpp | 47 ++-- inst/include/armadillo_bits/running_stat_vec_bones.hpp | 6 inst/include/armadillo_bits/running_stat_vec_meat.hpp | 21 +- inst/include/armadillo_bits/subview_meat.hpp | 23 +- inst/include/armadillo_bits/traits.hpp | 16 - inst/include/armadillo_bits/typedef_u64.hpp | 21 -- 25 files changed, 446 insertions(+), 296 deletions(-) More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Thu, 26 May 2011
JPM Chase Corporate Challenge 2011
The race went ok -- I didn't go out too fast, maintained pace and was able to accelerate towards the end. My hand-stopped time was 22:58; for the first time we actually had chip timing in this race and my official time appears to be 23:00. Which is still 50+ seconds faster than last year, and a pace of around 6:34 and compares well to the other eight previous times I've run this. /sports/running | permanent link
RcppArmadillo 0.2.20
Also added in this version is a new example of a simulation of a vector autoregression process which I had blogged about earlier. The example had been prepared for the Rcpp workshop / class at last month's R/Finance conference, and demonstrates a rather nice speed gain from using Rcpp and RcppArmadillo. The short NEWS file extract follows below.
And courtesy of
CRANberries, here is
the
diff to the previous release.
Diff between RcppArmadillo versions 0.2.19 dated 2011-04-24 and 0.2.20 dated 2011-05-26 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/Col_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/Cube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/GlueCube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/Glue_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/Mat_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/OpCube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/Op_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/Row_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/arrayops_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/atlas_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/auxlib_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/blas_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/diagview_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/diskio_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/eGlue_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/eOpCube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/eOp_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/eglue_core_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/eop_core_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/field_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/fn_htrans.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/forward_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_conv_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_cor_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_cov_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_cross_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_join_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_kron_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_relational_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_solve_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_times_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/injector_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/lapack_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/mtGlue_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/mtOpCube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/mtOp_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_chol_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_cor_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_cov_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_diagvec_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_dot_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_dotext_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_find_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_flip_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_htrans_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_inv_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_max_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_mean_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_median_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_min_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_misc_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_pinv_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_princomp_cov_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_princomp_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_prod_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_relational_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_repmat_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_reshape_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_shuffle_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_sort_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_stddev_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_sum_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_trans_meat.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_trans_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_trimat_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/op_var_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/podarray_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/running_stat_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/subview_cube_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/subview_field_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/subview_proto.hpp |only RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/wall_clock_proto.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/ChangeLog | 20 RcppArmadillo-0.2.20/RcppArmadillo/DESCRIPTION | 10 RcppArmadillo-0.2.20/RcppArmadillo/inst/NEWS | 26 RcppArmadillo-0.2.20/RcppArmadillo/inst/examples |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/RcppArmadillo/Mat_meat.h | 8 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo | 199 - RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Col_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Col_meat.hpp | 519 +++ RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Cube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Cube_meat.hpp | 96 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/GlueCube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Glue_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Mat_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Mat_meat.hpp | 673 +++- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/OpCube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Op_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Proxy.hpp | 28 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/ProxyCube.hpp | 20 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Row_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/Row_meat.hpp | 491 +++ RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp | 87 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/arma_static_assert.hpp | 31 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp | 6 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/arrayops_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/arrayops_meat.hpp | 143 - RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/atlas_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/auxlib_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp | 772 ++++- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/blas_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp | 17 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/debug.hpp | 24 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/diagmat_proxy.hpp | 93 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/diagview_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/diagview_meat.hpp | 128 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/diskio_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp | 104 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eGlueCube_meat.hpp | 14 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eGlue_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eGlue_meat.hpp | 14 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eOpCube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eOp_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eglue_core_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eglue_core_meat.hpp | 519 ++- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eop_core_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/eop_core_meat.hpp | 327 +- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/field_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_accu.hpp | 40 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_det.hpp | 7 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_diagmat.hpp | 7 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_elem.hpp | 62 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_eye.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_inv.hpp | 18 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_log_det.hpp | 8 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_max.hpp | 38 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_mean.hpp | 42 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_median.hpp | 53 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_min.hpp | 38 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_ones.hpp | 45 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_prod.hpp | 20 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_randn.hpp | 10 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_randu.hpp | 12 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_stddev.hpp | 20 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_strans.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_syl_lyap.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_symmat.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_trans.hpp | 35 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_var.hpp | 20 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/fn_zeros.hpp | 12 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/forward_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/gemm.hpp | 337 -- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/gemm_mixed.hpp | 59 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/gemv.hpp | 208 + RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_conv_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_conv_meat.hpp | 16 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_cor_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_cor_meat.hpp | 12 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_cov_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_cross_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_cross_meat.hpp | 47 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_join_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_join_meat.hpp | 46 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_kron_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_mixed_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_relational_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_solve_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_times_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_times_meat.hpp | 493 +-- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/glue_toeplitz_meat.hpp | 5 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/injector_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/lapack_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/mtGlueCube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/mtGlue_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/mtOpCube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/mtOp_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_chol_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_cor_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_cor_meat.hpp | 14 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_cov_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_cumsum_meat.hpp | 9 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_cx_scalar_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_diagmat_meat.hpp | 10 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_diagvec_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_dot_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_dotext_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_find_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_flip_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_htrans_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_htrans_meat.hpp | 98 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_inv_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_inv_meat.hpp | 13 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_max_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_max_meat.hpp | 57 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_mean_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_mean_meat.hpp | 34 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_median_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_median_meat.hpp | 214 - RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_min_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_min_meat.hpp | 33 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_misc_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_pinv_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_pinv_meat.hpp | 10 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_princomp_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_princomp_cov_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_prod_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_prod_meat.hpp | 34 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_relational_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_repmat_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_repmat_meat.hpp | 29 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_reshape_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_reshape_meat.hpp | 32 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_shuffle_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_shuffle_meat.hpp | 10 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_sort_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_stddev_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_stddev_meat.hpp | 34 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_strans_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_strans_meat.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_sum_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_sum_meat.hpp | 38 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_symmat_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_symmat_meat.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_trimat_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_trimat_meat.hpp | 190 + RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_var_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/op_var_meat.hpp | 37 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/operator_times.hpp | 12 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/podarray_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/podarray_meat.hpp | 57 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/promote_type.hpp | 18 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/running_stat_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/running_stat_meat.hpp | 2 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/running_stat_vec_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_cube_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_cube_meat.hpp | 50 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_elem1_meat.hpp | 24 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_field_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_field_meat.hpp | 37 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/subview_meat.hpp | 1423 +++++++++- RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/traits.hpp | 69 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/typedef_u64.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/undefine_conflicts.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/unwrap.hpp | 64 RcppArmadillo-0.2.20/RcppArmadillo/inst/include/armadillo_bits/wall_clock_bones.hpp |only RcppArmadillo-0.2.20/RcppArmadillo/src/RcppArmadillo.cpp | 27 253 files changed, 6400 insertions(+), 2358 deletions(-) More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Wed, 25 May 2011
R / Finance 2011 presentations
The organizing committee for the R/Finance 2011 conference is pleased to announce the availability of presentation slides from the 3rd annual R/Finance conference. This year's two-day conference once again attracted over 200 participants from across the globe. Academics, students and industry professionals enjoyed almost 30 talks covering trading, optimization, risk management and more --- all using R! Enjoy! Fri, 29 Apr 2011
Slides from Rcpp workshop / master class yesterday
Update: One link corrected. Mon, 25 Apr 2011
RInside 0.2.4
This new release contains a few small internal changes to the initialization
code, as well as a number of slightly improved examples employing more of the
simplifications which Rcpp offers.
Also included is a brand new example embedding R
inside of the Qt framework; an
earlier blog post
had already discussed this example. Two more examples were added to the
And courtesy of
CRANberries, here are
the
changes from the previous release.
RInside-0.2.3/RInside/inst/ChangeLog |only RInside-0.2.3/RInside/libRInside.a |only RInside-0.2.4/RInside/ChangeLog |only RInside-0.2.4/RInside/DESCRIPTION | 24 ++++-- RInside-0.2.4/RInside/R/RInsidePaths.R | 4 - RInside-0.2.4/RInside/doxyfile | 8 +- RInside-0.2.4/RInside/inst/NEWS |only RInside-0.2.4/RInside/inst/THANKS | 1 RInside-0.2.4/RInside/inst/examples/mpi/rinside_mpi_sample0.cpp | 10 +- RInside-0.2.4/RInside/inst/examples/mpi/rinside_mpi_sample1.cpp | 11 +-- RInside-0.2.4/RInside/inst/examples/mpi/rinside_mpi_sample2.cpp | 10 +- RInside-0.2.4/RInside/inst/examples/mpi/rinside_mpi_sample3.cpp | 9 -- RInside-0.2.4/RInside/inst/examples/qt |only RInside-0.2.4/RInside/inst/examples/standard/rinside_sample1.cpp | 30 ++++---- RInside-0.2.4/RInside/inst/examples/standard/rinside_sample10.cpp |only RInside-0.2.4/RInside/inst/examples/standard/rinside_sample11.cpp |only RInside-0.2.4/RInside/inst/examples/standard/rinside_sample2.cpp | 15 +--- RInside-0.2.4/RInside/inst/examples/standard/rinside_sample3.cpp | 6 - RInside-0.2.4/RInside/inst/examples/standard/rinside_sample5.cpp | 10 +- RInside-0.2.4/RInside/inst/examples/standard/rinside_sample6.cpp | 12 +-- RInside-0.2.4/RInside/inst/examples/standard/rinside_sample7.cpp | 9 -- RInside-0.2.4/RInside/inst/examples/standard/rinside_sample9.cpp | 2 RInside-0.2.4/RInside/inst/include/RInsideAutoloads.h | 35 ++++++++-- RInside-0.2.4/RInside/inst/include/RInsideEnvVars.h | 13 +-- RInside-0.2.4/RInside/src/Makevars | 2 RInside-0.2.4/RInside/src/RInside.cpp | 21 +++--- 26 files changed, 121 insertions(+), 111 deletions(-) More information is on the RInside page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. /code/rinside | permanent link Sun, 24 Apr 2011
RcppArmadillo 0.2.19
The short NEWS file extract follows below containing just Conrad's entry for 1.2.0. No further changes from our side (and the benchmark comparison between R, compiled R and Rcpp for computing a VAR(1) dataset which I blogged about yesterday is only in SVN and will be in the next release.)
And courtesy of
CRANberries, here are
the
diffs to the previous release.
RcppArmadillo-0.2.18/RcppArmadillo/inst/doc/RcppArmadillo-unitTests.tex |only RcppArmadillo-0.2.19/RcppArmadillo/ChangeLog | 10 RcppArmadillo-0.2.19/RcppArmadillo/DESCRIPTION | 10 RcppArmadillo-0.2.19/RcppArmadillo/R/fastLm.R | 2 RcppArmadillo-0.2.19/RcppArmadillo/inst/NEWS | 22 RcppArmadillo-0.2.19/RcppArmadillo/inst/doc/Makefile | 5 RcppArmadillo-0.2.19/RcppArmadillo/inst/doc/RcppArmadillo-unitTests.pdf |binary RcppArmadillo-0.2.19/RcppArmadillo/inst/doc/unitTests-results/RcppArmadillo-unitTests.html | 16 RcppArmadillo-0.2.19/RcppArmadillo/inst/doc/unitTests-results/RcppArmadillo-unitTests.txt | 40 - RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_meat.hpp | 14 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/arma_ostream_proto.hpp | 4 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/arma_version.hpp | 6 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/auxlib_meat.hpp | 128 +-- RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/blas_proto.hpp | 92 +- RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/compiler_setup.hpp | 12 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/config.hpp | 3 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/constants.hpp | 20 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/diskio_meat.hpp | 2 RcppArmadillo-0.2.19/RcppArmadillo/inst/include/armadillo_bits/lapack_proto.hpp | 344 ++++++---- 19 files changed, 460 insertions(+), 270 deletions(-) More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Sat, 23 Apr 2011
Another nice Rcpp example
And I received a few friendly answers. My favourite, so far, was a suggestion by Lance Bachmeier who sent me a short script which used both R and C++ (via Rcpp) to simulate a first-order vector autoregressive process (and he ensured me that it worked well enough on his graduate students). It is indeed a great example as it involves (simple) matrix multiplication in an iterative fashion. Which makes it a great example not only for Rcpp but also for our RcppArmadillo package (which wraps Conrad Sanderson's wonderful Armadillo C++ templated library for linear algebra and more). And at the same time, we can also add another look at the new and shiny R compiler I also blogged about recently. So Lance and I iterated over this a little more over email, and I now added this as a new (and initial) example file in the RcppArmadillo SVN repo. (As an aside: The newest version 0.2.19 of RcppArmadillo has been sitting in incoming at CRAN since earlier in the week while the archive maintainer takes a well-deserved vacation. It should hit the public archive within a few days, and is otherwise available too from my site.) So let's walk through the example: This starts with a simple enough loop. After skipping the first row, each iteration multiplies the previous row with the parameters and adds error terms.R> ## parameter and error terms used throughout R> a <- matrix(c(0.5,0.1,0.1,0.5),nrow=2) R> e <- matrix(rnorm(10000),ncol=2) R> ## Let's start with the R version R> rSim <- function(coeff, errors) { + simdata <- matrix(0, nrow(errors), ncol(errors)) + for (row in 2:nrow(errors)) { + simdata[row,] = coeff %*% simdata[(row-1),] + errors[row,] + } + return(simdata) + } R> rData <- rSim(a, e) # generated by R We can then turn to the R compiler: Nice and easy: We load the compiler package, create a compiled function and use it. We check the results and surely enough find them to be identical.R> ## Now let's load the R compiler (requires R 2.13 or later) R> suppressMessages(require(compiler)) R> compRsim <- cmpfun(rSim) R> compRData <- compRsim(a,e) # generated by R 'compiled' R> stopifnot(all.equal(rData, compRData)) # checking results With that, time to turn to C++ using Armadillo via RcppArmadillo: Here we load the inline package to compile, link and load C++ snippets. We define a short C++ function in theR> ## Now load 'inline' to compile C++ code on the fly R> suppressMessages(require(inline)) R> code <- ' + arma::mat coeff = Rcpp::as<arma::mat>(a); + arma::mat errors = Rcpp::as<arma::mat>(e); + int m = errors.n_rows; int n = errors.n_cols; + arma::mat simdata(m,n); + simdata.row(0) = arma::zeros<arma::mat>(1,n); + for (int row=1; row<m; row++) { + simdata.row(row) = simdata.row(row-1)*trans(coeff)+errors.row(row); + } + return Rcpp::wrap(simdata); + ' R> ## create the compiled function R> rcppSim <- cxxfunction(signature(a="numeric",e="numeric"), + code,plugin="RcppArmadillo") R> rcppData <- rcppSim(a,e) # generated by C++ code R> stopifnot(all.equal(rData, rcppData)) # checking results code variable, declare a signature taking a and e as before and ask
cxxfunction() to deploy the plugin for RcppArmadillo so
that it and Rcpp are found during build. With that, we have a compiled function
to generate data, and we once again check the result. The C++ code is pretty straightforward as well. We can instatiate Armadillo matrices
directly from the R objects we pass down; we then run a similar loop building the result row by row.
Now, with all the build-up, here is the final timing comparison, using the rbenchmark package: So in a real-world example involving looping and some algebra (which is of course already done by BLAS and LAPACK libraries), the new R compiler improves by more than a factor of two, cutting time from 4.14 seconds down to about 2 seconds. Yet, this still leaves the C++ solution, clocking in at a mere 38 milliseconds, ahead by a factor of over fifty relative to the new R compilerR> ## now load the rbenchmark package and compare all three R> suppressMessages(library(rbenchmark)) R> res <- benchmark(rcppSim(a,e), + rSim(a,e), + compRsim(a,e), + columns=c("test", "replications", "elapsed", + "relative", "user.self", "sys.self"), + order="relative") R> print(res) test replications elapsed relative user.self sys.self 1 rcppSim(a, e) 100 0.038 1.0000 0.04 0 3 compRsim(a, e) 100 2.011 52.9211 2.01 0 2 rSim(a, e) 100 4.148 109.1579 4.14 0 And compared to just R itself, the simple solution involving Rcpp and RcppArmadillo is almost 110 times faster. As I mentioned, I quite like this example ;-). /code/snippets | permanent link Fri, 15 Apr 2011
Dianne Reeves at the CSO
/music/jazz/live | permanent link Wed, 13 Apr 2011
Rcpp 0.9.4, and a paper in the Journal of Statistical Software
This version contains an improvement to loading and initialization of Rcpp modules, a bug fix for vectors of factors, another build issue fix as well as (per common practice with JSS) citation information for the article Rcpp: Seamless R and C++ Integration which is now Volume 40, Issue 8 in the Journal of Statistical Software (or JSS for short). The complete NEWS entry is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, there is
also a
diff to the previous release 0.9.3:
Diff between Rcpp versions 0.9.3 dated 2011-04-05 and 0.9.4 dated 2011-04-12 Rcpp-0.9.3/Rcpp/build |only Rcpp-0.9.3/Rcpp/inst/skeleton/yada.Rd |only Rcpp-0.9.3/Rcpp/inst/unitTests/testRcppModule/R/Modules.R |only Rcpp-0.9.3/Rcpp/inst/unitTests/testRcppModule/man/yada.Rd |only Rcpp-0.9.4/Rcpp/ChangeLog | 55 Rcpp-0.9.4/Rcpp/DESCRIPTION | 10 Rcpp-0.9.4/Rcpp/NAMESPACE | 29 Rcpp-0.9.4/Rcpp/R/Rcpp.package.skeleton.R | 11 Rcpp-0.9.4/Rcpp/R/loadRcppModules.R |only Rcpp-0.9.4/Rcpp/inst/CITATION |only Rcpp-0.9.4/Rcpp/inst/NEWS | 17 Rcpp-0.9.4/Rcpp/inst/doc/Makefile | 2 Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-FAQ.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw | 153 +- Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-extending.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-extending/Rcpp-extending.Rnw | 2 Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-introduction.Rnw | 734 ++++------ Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-introduction.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-modules.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-modules/Rcpp-modules.Rnw | 36 Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-package.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-package/Rcpp-package.Rnw | 4 Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-quickref.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-quickref/Rcpp-quickref.Rnw | 34 Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-sugar.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-sugar/Rcpp-sugar.Rnw | 2 Rcpp-0.9.4/Rcpp/inst/doc/Rcpp-unitTests.pdf |binary Rcpp-0.9.4/Rcpp/inst/doc/Rcpp.bib | 73 Rcpp-0.9.4/Rcpp/inst/doc/unitTests-results/Rcpp-unitTests.html | 18 Rcpp-0.9.4/Rcpp/inst/doc/unitTests-results/Rcpp-unitTests.txt | 40 Rcpp-0.9.4/Rcpp/inst/include/Rcpp/config.h | 2 Rcpp-0.9.4/Rcpp/inst/skeleton/zzz.R | 11 Rcpp-0.9.4/Rcpp/inst/unitTests/runit.Module.client.package.R | 27 Rcpp-0.9.4/Rcpp/inst/unitTests/runit.Vector.R | 18 Rcpp-0.9.4/Rcpp/inst/unitTests/testRcppModule/DESCRIPTION | 2 Rcpp-0.9.4/Rcpp/inst/unitTests/testRcppModule/NAMESPACE | 3 Rcpp-0.9.4/Rcpp/inst/unitTests/testRcppModule/R/zzz.R |only Rcpp-0.9.4/Rcpp/inst/unitTests/testRcppModule/src/rcpp_module.cpp | 6 Rcpp-0.9.4/Rcpp/inst/unitTests/testRcppModule/src/stdVector.cpp | 18 Rcpp-0.9.4/Rcpp/inst/unitTests/testRcppModule/tests/modules.R | 21 Rcpp-0.9.4/Rcpp/man/Rcpp-package.Rd | 6 Rcpp-0.9.4/Rcpp/man/loadRcppModules.Rd |only Rcpp-0.9.4/Rcpp/src/r_cast.cpp | 9 43 files changed, 647 insertions(+), 696 deletions(-) As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page
RProtoBuf 0.2.3
The NEWS file entry follows below:
And courtesy of
CRANberries, here is
the
diff to the previous release 0.2.2:
Diff between RProtoBuf versions 0.2.2 dated 2011-01-12 and 0.2.3 dated 2011-04-13 RProtoBuf-0.2.2/RProtoBuf/inst/doc/RProtoBuf-quickref.Rnw |only RProtoBuf-0.2.3/RProtoBuf/ChangeLog | 23 RProtoBuf-0.2.3/RProtoBuf/DESCRIPTION | 8 RProtoBuf-0.2.3/RProtoBuf/R/with.R | 12 RProtoBuf-0.2.3/RProtoBuf/cleanup | 3 RProtoBuf-0.2.3/RProtoBuf/inst/NEWS | 10 RProtoBuf-0.2.3/RProtoBuf/inst/doc/Makefile | 42 RProtoBuf-0.2.3/RProtoBuf/inst/doc/RProtoBuf-quickref.pdf |binary RProtoBuf-0.2.3/RProtoBuf/inst/doc/RProtoBuf-unitTests.pdf |binary RProtoBuf-0.2.3/RProtoBuf/inst/doc/RProtoBuf.pdf | 1267 +++++----- RProtoBuf-0.2.3/RProtoBuf/inst/doc/unitTests-results/RProtoBuf-unitTests.html | 20 RProtoBuf-0.2.3/RProtoBuf/inst/doc/unitTests-results/RProtoBuf-unitTests.txt | 14 RProtoBuf-0.2.3/RProtoBuf/src/extractors.cpp | 44 RProtoBuf-0.2.3/RProtoBuf/src/mutators.cpp | 55 RProtoBuf-0.2.3/RProtoBuf/src/wrapper_FieldDescriptor.cpp | 24 15 files changed, 819 insertions(+), 703 deletions(-) As always, there is more information at the RProtoBuf page which has a draft package vignette, a 'quick' overview vignette and a unit test summary vignette. Questions, comments etc should go to the rprotobuf mailing list off the RProtoBuf page at R-Forge. /code/rprotobuf | permanent link Tue, 12 Apr 2011
The new R compiler package in R 2.13.0: Some first experiments
so the compiler is not yet used for R's own base and recommended packages.
While working on my slides for the upcoming Rcpp workshop preceding R/Finance 2011, I thought of a nice test example to illustrate the compiler. Last summer and fall, Radford Neal had sent a very nice, long and detailed list of possible patches for R performance improvements to the development list. Some patches were integrated and some more discussion ensued. One strand was on the difference in parsing between normal parens and curly braces. In isolation, these seem too large, but (as I recall) this is due some things 'deep down' in the parser. However, some folks really harped on this topic. And it just doesn't die as a post from last week demonstrated once more. Last year, Christian Robert had whittled it down to a set of functions, and I made a somewhat sarcastic post argueing that I'd rather use Rcpp to get 80-fold speed increase than spend my time argueing over ten percent changes in code that could be made faster so easily.
So let us now examine what the compiler package can do for us. The starting point is the same as last year: five variants
of computing 1/(1+x) for a scalar x inside an explicit This replicates Christian's result. We find that function> ## cf http://dirk.eddelbuettel.com/blog/2010/09/07#straight_curly_or_compiled > f <- function(n, x=1) for (i in 1:n) x=1/(1+x) > g <- function(n, x=1) for (i in 1:n) x=(1/(1+x)) > h <- function(n, x=1) for (i in 1:n) x=(1+x)^(-1) > j <- function(n, x=1) for (i in 1:n) x={1/{1+x}} > k <- function(n, x=1) for (i in 1:n) x=1/{1+x} > ## now load some tools > library(rbenchmark) > ## now run the benchmark > N <- 1e6 > benchmark(f(N,1), g(N,1), h(N,1), j(N,1), k(N,1), + columns=c("test", "replications", + "elapsed", "relative"), + order="relative", replications=10) test replications elapsed relative 5 k(N, 1) 10 9.764 1.00000 1 f(N, 1) 10 9.998 1.02397 4 j(N, 1) 10 11.019 1.12853 2 g(N, 1) 10 11.822 1.21077 3 h(N, 1) 10 14.560 1.49119 k() is the fastest using curlies, and that explicit exponentiation in
function h() is the slowest with a relative penalty of 49%, or an absolute difference of almost five seconds between the 9.7
for the winner and 14.6 for the worst variant. On the other hand, function f(), the normal way of writing things, does pretty
well.
So what happens when we throw the compiler into the mix? Let's first create compiled variants using the new Now things have gotten interesting and substantially faster, for very little cost. Usage is straightforward: take your function and compile it, and reap more than a threefold speed gain. Not bad at all. Also of note, the difference between the different expressions essentially vanishes. The explicit exponentiation is still the loser, but there may be an additional explicit function call involved.> ## R 2.13.0 brings this toy > library(compiler) > lf <- cmpfun(f) > lg <- cmpfun(g) > lh <- cmpfun(h) > lj <- cmpfun(j) > lk <- cmpfun(k) > # now run the benchmark > N <- 1e6 > benchmark(f(N,1), g(N,1), h(N,1), j(N,1), k(N,1), + lf(N,1), lg(N,1), lh(N,1), lj(N,1), lk(N,1), + columns=c("test", "replications", + "elapsed", "relative"), + order="relative", replications=10) test replications elapsed relative 9 lj(N, 1) 10 2.971 1.00000 10 lk(N, 1) 10 2.980 1.00303 6 lf(N, 1) 10 2.998 1.00909 7 lg(N, 1) 10 3.007 1.01212 8 lh(N, 1) 10 4.024 1.35443 1 f(N, 1) 10 9.479 3.19051 5 k(N, 1) 10 9.526 3.20633 4 j(N, 1) 10 10.775 3.62673 2 g(N, 1) 10 11.299 3.80310 3 h(N, 1) 10 14.049 4.72871
So we do see the new compiler as a potentially very useful addition. I am sure more folks will jump on this and run more
tests to find clearer corner cases. To finish, we have to of course once more go back to
Rcpp for some Rcpp still shoots the lights out by a factor of 80 (or even almost 120 to the worst manual implementation) relative to interpreted code. Relative to the compiled byte code, the speed difference is about 25-fold. Now, these are of course entirely unrealistic code examples that are in no way, shape or form representative of real R work. Effective speed gains will be smaller for both the (pretty exciting new) compiler package and also for our C++ integration package Rcpp.> ## now with Rcpp and C++ > library(inline) > ## and define our version in C++ > src <- 'int n = as<int>(ns); + double x = as<double>(xs); + for (int i=0; i<n; i++) x=1/(1+x); + return wrap(x); ' > l <- cxxfunction(signature(ns="integer", + xs="numeric"), + body=src, plugin="Rcpp") > ## now run the benchmark again > benchmark(f(N,1), g(N,1), h(N,1), j(N,1), k(N,1), + l(N,1), + lf(N,1), lg(N,1), lh(N,1), lj(N,1), lk(N,1), + columns=c("test", "replications", + "elapsed", "relative"), + order="relative", replications=10) test replications elapsed relative 6 l(N, 1) 10 0.120 1.0000 11 lk(N, 1) 10 2.961 24.6750 7 lf(N, 1) 10 3.128 26.0667 8 lg(N, 1) 10 3.140 26.1667 10 lj(N, 1) 10 3.161 26.3417 9 lh(N, 1) 10 4.212 35.1000 5 k(N, 1) 10 9.500 79.1667 1 f(N, 1) 10 9.621 80.1750 4 j(N, 1) 10 10.868 90.5667 2 g(N, 1) 10 11.409 95.0750 3 h(N, 1) 10 14.077 117.3083 Before I close, two more public service announcements. First, if you use Ubuntu see this post by Michael on r-sig-debian announcing his implementation of a suggestion of mine: we now have R alpha/beta/rc builds via his Launchpad PPA. Last Friday, I had the current R-rc snapshot of R 2.13.0 on my Ubuntu box only about six hours after I (as Debian maintainer for R) uploaded the underlying new R-rc package build to Debian unstable. This will be nice for testing of upcoming releases. Second, as I mentioned, the Rcpp workshop on April 28 preceding R/Finance 2011 on April 29 and 30 still has a few slots available, as has the conference itself. Thu, 07 Apr 2011
Review of 'R in a Nutshell' by J Adler now in JSS
RcppClassic 0.9.1
It contains no new code, but smoothes one or two edges in the build process
and noticed by the newest versions of
Courtesy of CRANberries, here are the changes to the previous release. Diff between RcppClassic versions 0.9.0 dated 2010-12-20 and 0.9.1 dated 2011-04-07 RcppClassic-0.9.0/RcppClassic/build |only RcppClassic-0.9.0/RcppClassic/inst/lib |only RcppClassic-0.9.1/RcppClassic/ChangeLog | 17 ++++++ RcppClassic-0.9.1/RcppClassic/DESCRIPTION | 8 +-- RcppClassic-0.9.1/RcppClassic/inst/doc/Makefile | 25 ++++++---- RcppClassic-0.9.1/RcppClassic/inst/doc/RcppClassic-unitTests.pdf |binary RcppClassic-0.9.1/RcppClassic/inst/doc/RcppClassic.pdf |binary RcppClassic-0.9.1/RcppClassic/inst/doc/unitTests-results/RcppClassic-unitTests.html |only RcppClassic-0.9.1/RcppClassic/inst/doc/unitTests-results/RcppClassic-unitTests.txt |only RcppClassic-0.9.1/RcppClassic/inst/unitTests/runit.RcppDate.R | 24 ++++----- 10 files changed, 49 insertions(+), 25 deletions(-) Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Wed, 06 Apr 2011
Rcpp workshop / master class on April 28 in Chicago
I realized I never announced this on the blog, so without further ado.... Rcpp Workshop in Chicago on April 28, 2011This year's R/Finance conference will be preceded by a full-day masterclass on Rcpp and related topics which will be held on Thursday, April 28, 2011, on the University of Illinois at Chicago campus. Join Dirk Eddelbuettel and Romain Francois for six hours of detailed and hands-on instructions and discussions around Rcpp, inline, RInside, RcppArmadillo and other packages---in an intimate small-group setting. The full-day format allows to combine a morning introductory session with a more advanced afternoon session while leaving room for sufficient breaks. There will be about six hours of instructions, a one-hour lunch break and two half-hour coffee breaks. Morning session: "A hands-on introduction to R and C++"The morning session will provide a practical introduction to the Rcpp package (and other related packages). The focus will be on simple and straightforward applications of Rcpp in order to extend R and/or to significantly accelerate the execution of simple functions. The tutorial will cover the inline package which permits embedding of self-contained C, C++ or Fortran code in R scripts. We will also discuss RInside to embed R code in C++ applications, as well as standard Rcpp extension packages such as RcppArmadillo for linear algebra and RcppGSL. Afternoon session: "Advanced R and C++ topics"This afternoon tutorial will provide a hands-on introduction to more advanced Rcpp features. It will cover topics such as writing packages that use Rcpp, how 'Rcpp modules' and the new R ReferenceClasses interact, and how 'Rcpp sugar' lets us write C++ code that is often as expressive as R code. Another possible topic, time permitting, may be writing glue code to extend Rcpp to other C++ projects. We also hope to leave some time to discuss problems brought by the class participants. PrerequisitesKnowledge of R as well as general programming knowledge; C or C++ knowledge is helpful but not required. Users should bring a laptop set up so that R packages can be built. That means on Windows, Rtools needs to be present and working, and on OS X the Xcode package should be installed. RegistrationRegistration is available via the R/Finance conference at http://www.RinFinance.com/register/ or directly at RegOnline http://www.regonline.com/930153 The cost is USD 500 for the whole day, and space will be limited. QuestionsPlease contact us directly at RomainAndDirk@r-enthusiasts.com.
RcppGSL 0.1.1
It contains no new code, but smoothes one or two edges in the build process
and noticed by the newest versions of
The short NEWS file extract follows below.
And courtesy of
CRANberries, here are
the changes to
the previous release.
Diff between RcppGSL versions 0.1.0 dated 2010-12-01 and 0.1.1 dated 2011-04-06 ChangeLog | 22 ++++++++++++++++++++ DESCRIPTION | 8 +++---- inst/NEWS | 8 +++++++ inst/doc/Makefile | 28 ++++++++++++++++++++------ inst/doc/RcppGSL-unitTests.Rnw |only inst/doc/RcppGSL-unitTests.pdf |only inst/doc/RcppGSL-unitTests.tex |only inst/doc/RcppGSL.pdf |binary inst/doc/RcppGSL/RcppGSL.Rnw | 43 ++++++++++++++++++----------------------- inst/doc/unitTests |only src/Makevars.in | 2 - 11 files changed, 75 insertions(+), 36 deletions(-) More information is on the RcppGSL page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Tue, 05 Apr 2011
Rcpp 0.9.3
This version contains an actual bug fix for Rcpp modules and a few build improvements, including for both clang/llvm and g++-4.6 (which, being in Debian, is already used for conformance checks on CRAN's incoming directory) and g++-4.5. We also updated the main introductory vignette Rcpp-introduction to the content of what should be a forthcoming paper in the Journal of Statistical Software. The complete NEWS entry is below; more details are in the ChangeLog file in the package and on the Rcpp Changelog page.
Thanks to
CRANberries, there is
also a
diff to the previous release 0.9.2:
Diff between Rcpp versions 0.9.2 dated 2011-02-24 and 0.9.3 dated 2011-04-05 ChangeLog | 60 DESCRIPTION | 8 R/00_classes.R | 5 R/01_show.R | 44 R/Module.R | 1 cleanup | 2 inst/NEWS | 23 inst/doc/Makefile | 74 inst/doc/Rcpp-FAQ.pdf |binary inst/doc/Rcpp-FAQ/Rcpp-FAQ.Rnw | 2 inst/doc/Rcpp-extending.pdf |binary inst/doc/Rcpp-introduction.Rnw | 1355 +++++++------ inst/doc/Rcpp-introduction.pdf |binary inst/doc/Rcpp-modules.pdf |binary inst/doc/Rcpp-package.pdf |binary inst/doc/Rcpp-quickref.pdf |binary inst/doc/Rcpp-sugar.pdf |binary inst/doc/Rcpp-unitTests.pdf |binary inst/doc/Rcpp.bib | 99 inst/doc/jss.bst |only inst/doc/unitTests-results/Rcpp-unitTests.html | 18 inst/doc/unitTests-results/Rcpp-unitTests.txt | 46 inst/include/Rcpp/Module.h | 40 inst/include/Rcpp/Vector.h | 6 inst/include/Rcpp/config.h | 2 inst/include/Rcpp/grow.h | 91 inst/include/Rcpp/module/Module_generated_ctor_signature.h | 18 inst/include/Rcpp/vector/RangeIndexer.h | 5 inst/include/RcppCommon.h | 6 inst/unitTests/runit.Module.R | 19 inst/unitTests/testRcppModule/src/stdVector.cpp | 7 src/exceptions.cpp | 2 32 files changed, 1167 insertions(+), 766 deletions(-) As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Mon, 04 Apr 2011
RQuantLib 0.3.7
Thanks to the help by Brian Ripley (who compiled QuantLib for 64 bit Windows), Josh Ulrich (who did the same for 32 bit Windows, and arranged the Windows builds) and Uwe Ligges (who runs win-builder for R) we once again have Windows binaries as well as the usual source distribution (and Debian binaries).
The only other change was minor fix to the documentation files. We had found that the pdf reference manual build would break for Uwe and
Kurt (using A4 paper settings) but not myself (using letter). Uwe finally tracked that down: we had some arguments to Thanks to CRANberries, there is also a diff to the previous release 0.3.6. Full changelog details, examples and more details about this package are at my RQuantLib page. /code/rquantlib | permanent link
RcppArmadillo 0.2.18
The short NEWS file extract follows below containing just Conrad's entry for 1.1.92. No further changes from our side.
And courtesy of
CRANberries, here are
the
diffs to the previous release.
ChangeLog | 8 ++ DESCRIPTION | 10 +-- inst/NEWS | 7 ++ inst/doc/Makefile | 2 inst/doc/RcppArmadillo-unitTests.tex |only inst/include/armadillo_bits/Cube_meat.hpp | 12 --- inst/include/armadillo_bits/Cube_proto.hpp | 4 - inst/include/armadillo_bits/Mat_meat.hpp | 2 inst/include/armadillo_bits/Mat_proto.hpp | 4 - inst/include/armadillo_bits/arma_version.hpp | 4 - inst/include/armadillo_bits/glue_cor_meat.hpp | 83 ++++++++++++-------------- 11 files changed, 73 insertions(+), 63 deletions(-) More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Sun, 03 Apr 2011
Race That's Good For Life 2011
Given the lack of (more intense) training, I am also a lot slower: 21:50.7 was the chip time, or a 7:02 pace. We will see if I ever get faster again. On race day I am usually motivated; it remains to be seen if I get over to the track in the early morning to push myself through some speedwork. /sports/running | permanent link Sat, 26 Mar 2011
Branford Marsalis and Terence Blanchard
/music/jazz/live | permanent link |
|||||