|
|
Thinking inside the box | |||||
|
Bio
Code Linux Quantian About Blog
|
Louis: A Silent Film with Live Music
The film, which is written, directed and producted by Dan Pritzker, is based loosely on the early years of Louis Armstrong in New Orleans. The movie is shot beautifully by Vilmos Zsigmond in blend of colour and black-and-white which works very well for invoking the early days of film. A key part of the production is of course the score, and the live music with both a thirteen-piece orchestra featuring Wynton Marsalis as well as piano solo recitals by Cecile Licad with an emphasis on pieces by 19th-century composer Louis Moreau Gottschalk. The combination of a silent movie with a stong live band is something to behold -- if you can catch the movie and performance in a city nearby, go! /music/jazz/live | permanent link Mon, 09 Aug 2010
RQuantLib 0.3.4
This follows the 0.3.3 release from last week and has again a number of internal changes. All uses of objects from external namespaces are now explicit as I removed the remaining using namespace QuantLib;. This makes things a little more verbose, but should be much clearer to read, especially for those not yet up to speed on whether a given object comes from any one of the Boost, QuantLib or Rcpp namespaces. We also generalized an older three-dimensional plotting function used for option surfaces -- which had already been used in the demo() code -- and improved the code underlying this: arrays of option prices and analytics given two input vectors are now computed at the C++ level for a nice little gain in efficiency. This also illustrates the possible improvements from working with the new Rcpp API that is now used throughout the package, Full changelog details, examples and more details about this package are at my RQuantLib page. /code/rquantlib | permanent link Fri, 06 Aug 2010
RInside release 0.2.3
This is the first release since March when we released 0.2.2. A few things got added to Rcpp in the meantime, and RInside is taking advantage of some of these as illustrated in several of the included examples. More details and the changelog are on the RInside page which also leads /code/rinside | permanent link Thu, 05 Aug 2010
RcppArmadillo 0.2.5
This release upgrades the included Armadillo version to Conrad's just-released version 0.9.60. This overcomes some of minor issues we had with 'older' compilers such as g++ 4.2.x with x being 1 or 2. No other changes were made from our end. The short NEWS file extract follows:
0.2.5 2010-08-05
o Upgraded to Armadillo 0.9.60 "Killer Bush Turkey"
More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Wed, 04 Aug 2010
RQuantLib 0.3.3
Many of the changes in this new version are internal. The code was re-written using the new Rcpp API throughout, and the build system was further simplified using the LinkingTo: mechanism. The arithmetic average-price asian option pricer was added. A few other code updates were made as well. Full changelog details, examples and more details about this package are at my RQuantLib page. /code/rquantlib | permanent link Mon, 02 Aug 2010
RcppExamples 0.1.1
But at least this package now joins RcppArmadillo is using the highly-recommened LinkingTo: Rcpp directive in the DESCRIPTION file to let R find the Rcpp headers, making the build process a little more robust. A few more details on the page are on the RcppExamples page.
inline 0.3.6
RcppArmadillo 0.2.4
This release upgrades the included Armadillo version to 0.9.52 (see here for Conrad's high-level changes). We had to make two minor tweaks. In the fastLm() help page example we switched from inv() to pinv() The short NEWS file extract follows:
0.2.4 2010-07-27
o Upgraded to Armadillo 0.9.52 'Monkey Wrench'
o src/fastLm.cpp: Switch from inv() to pinv() as inv() now tests for
singular matrices and warns and returns an empty matrix which stops
the example fastLm() implementation on the manual page -- and while
this is generally reasonably it makes sense here to continue which
the Moore-Penrose pseudo-inverse allows us to do this
More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Mon, 26 Jul 2010
Rcpp 0.8.5
This release constitutes a quick follow-up to the last release 0.8.4 which we got out just before CRAN closed for summer vacations. Some fixes were made right after last release: two harmless warnings from the help file parser of the development version of R are now addressed, and we stopped using shell expansions in the Makefile snippets. We also added to some internal speedups we discovered while prepapring the talk about RProtoBuf for last week's useR! meeting. The NEWS entry follows below:
0.8.5 2010-07-25
o speed improvements. Vector::names, RObject::slot have been improved
to take advantage of R API functions instead of callbacks to R
o Some small updates to the Rd-based documentation which now points to
content in the vignettes. Also a small formatting change to suppress
a warning from the development version of R.
o Minor changes to Date() code which may reenable SunStudio builds
As always, even fuller details are in 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, 24 Jul 2010
useR 2010 at NIST in Gaithersburg
As at the preceding useR! 2008 in Dortmund and useR! 2009 in Rennes, I presented a three-hour tutorial on high-performance computing with R. This covers scripting/automation, profiling, vectorisation, interfacing compiled code, parallel computing and large-memory approaches. The slides, as well as a condensed 2-up version, are now on my presentations page. On Wednesday, Romain and I had a chance to talk about recent work on Rcpp, our R and C++ integration. Thursday, we followed up with a presentation on RProtoBuf -- a project integrating Google's Protocol Buffers with R which much to our delight already seems to be in use at Google itself! It was quite fun to do these two talks jointly with Romain. But my other coauthor Khanh had to be at a conference related to his actual PhD work. So on Friday it was just me to give a presentation about RQuantLib which brings QuantLib to R. Slides from all these talks have now been added to my presentations page. I will also upload them via the conference form so that they can be part of the conference's collection of presentations which should be forthcoming. Thu, 15 Jul 2010
Rcpp 0.8.4
This release builds upon release 0.8.3. Highlights include changes to the sugar framework for highly expressive C++ constructs which gained new vector function as well as a first set of matrix function. As well, unit tests have been reorganised in such a way that we end up with a lot fewer compilations (but of several files at once) which reaps significant speed gains. Date calculation now use the same mktime() function R itself uses (and which comes from Arthur Olson's tzone library). The NEWS entry follows below:
0.8.4 2010-07-09
o new sugar vector functions: rep, rep_len, rep_each, rev, head, tail,
diag
o sugar has been extended to matrices: The Matrix class now extends the
Matrix_Base template that implements CRTP. Currently sugar functions
for matrices are: outer, col, row, lower_tri, upper_tri, diag
o The unit tests have been reorganised into fewer files with one call
each to cxxfunction() (covering multiple tests) resulting in a
significant speedup
o The Date class now uses the same mktime() replacement that R uses
(based on original code from the timezone library by Arthur Olson)
permitting wide dates ranges on all operating systems
o The FastLM example has been updated, a new benchmark based on the
historical Longley data set has been added
o RcppStringVector now uses std::vector
As always, even fuller details are in 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, 29 Jun 2010
Rcpp 0.8.3
It comes about three weeks after the 0.8.2 release. And even though we promised to concentrate on documentation, it contains a raft of new features:
The main thing here is Rcpp sugar for which we also have a new (seventh !!) vignette Rcpp-sugar. As a quick example, consider this simple C++ function that takes two vectors from R and creates a new one conditional on the relative values: export "C" SEXP foo( SEXP xs, SEXP ys) { Rcpp::NumericVector x(xs), y(ys); int n = x.size(); Rcpp::NumericVector res( n ); double xd = 0.0, yd = 0.0 ; for( int i=0; i<n; i++){ xd = x[i]; yd = y[i]; if( xd < yd ){ res[i] = xd * xd ; } else { res[i] = -( yd * yd); } } return res ; }Now, if you use R, you really want to writes this more compactly. And now you can, thanks to Rcpp sugar: extern "C" SEXP foo( SEXP xs, SEXP ys){ Rcpp::NumericVector x(xs), y(xs); return ifelse( x < y, x*x, -(y*y)); }Same great taste, but much less filling! More details are in the Rcpp-sugar vignette. Doug Bates is already a fan of this and is employing it in the lme4a development version of the well-known lme4 package. The full NEWS entry for this release follows below:
0.8.3 2010-06-27
o This release adds Rcpp sugar which brings (a subset of) the R syntax
into C++. This supports :
- binary operators : <,>,<=,>=,==,!= between R vectors
- arithmetic operators: +,-,*,/ between compatible R vectors
- several functions that are similar to the R function of the same name:
abs, all, any, ceiling, diff, exp, ifelse, is_na, lapply, pmin, pmax,
pow, sapply, seq_along, seq_len, sign
Simple examples :
// two numeric vector of the same size
NumericVector x ;
NumericVector y ;
NumericVector res = ifelse( x < y, x*x, -(y*y) ) ;
// sapply'ing a C++ function
double square( double x ){ return x*x ; }
NumericVector res = sapply( x, square ) ;
Rcpp sugar uses the technique of expression templates, pioneered by the
Blitz++ library and used in many libraries (Boost::uBlas, Armadillo).
Expression templates allow lazy evaluation of expressions, which
coupled with inlining generates very efficient code, very closely
approaching the performance of hand written loop code, and often
much more efficient than the equivalent (vectorized) R code.
Rcpp sugar is curently limited to vectors, future releases will
include support for matrices with sugar functions such as outer, etc ...
Rcpp sugar is documented in the Rcpp-sugar vignette, which contains
implementation details.
o New helper function so that "Rcpp?something" brings up Rcpp help
o Rcpp Modules can now expose public data members
o New classes Date, Datetime, DateVector and DatetimeVector with proper
'new' API integration such as as(), wrap(), iterators, ...
o The so-called classic API headers have been moved to a subdirectory
classic/ This should not affect client-code as only Rcpp.h was ever
included.
o RcppDate now has a constructor from SEXP as well
o RcppDateVector and RcppDatetimeVector get constructors from int
and both const / non-const operator(int i) functions
o New API class Rcpp::InternalFunction that can expose C++ functions
to R without modules. The function is exposed as an S4 object of
class C++Function
As always, even fuller details are in 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, 15 Jun 2010
RcppArmadillo 0.2.3
It adds a tiny bit of configuration to permit Sun Studio / suncc to successfully build the package. There is no code change, and no configuration change for the other platforms. Thanks for Brian Ripley for additional testing, and of course for running those build instances (and everything else he does) for the R project, and to Conrad Sanderson as upstream author of the Armadillo C++ library for linear algebra. As usual, more information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Sun, 13 Jun 2010
Beancounter minor bug fix release 0.8.10
The new version is now in Debian, at CPAN and on my beancounter page here. Enjoy! /code/beancounter | permanent link Thu, 10 Jun 2010
Rcpp 0.8.2
The full NEWS entry for this release follows below:
0.8.2 2010-06-09
o Bug-fix release for suncc compiler with thanks to Brian Ripley for
additional testing.
As always, even fuller details are in 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, 09 Jun 2010
RcppArmadillo 0.2.2
This release works well with the most recent inline release 0.3.5. One can now employ inlined R code as we generalized how/which headers are included and how library / linking information is added thanks a plugin mechanism. This is the first RcppArmadillo version to provide such a plugin, We also updated the included Armadillo headers to its most recent release 0.9.10, added some more operators and provide a utility function RcppArmadillo:::CxxFlags() to provide include directory information on the fly. An example of the direct inline approach for the fastLm function: library(inline) library(RcppArmadillo) src <- ' Rcpp::NumericVector yr(ys); // creates Rcpp vector from SEXP Rcpp::NumericMatrix Xr(Xs); // creates Rcpp matrix from SEXP int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); // reuses memory and avoids extra copy arma::colvec y(yr.begin(), yr.size(), false); arma::colvec coef = arma::solve(X, y); // fit model y ~ X arma::colvec res = y - X*coef; // residuals double s2 = std::inner_product(res.begin(), res.end(), res.begin(), double())/(n - k); // std.errors of coefficients arma::colvec std_err = arma::sqrt(s2 * arma::diagvec( arma::inv(arma::trans(X)*X) )); return Rcpp::List::create(Rcpp::Named("coefficients") = coef, Rcpp::Named("stderr") = std_err, Rcpp::Named("df") = n - k ); ' fun <- cxxfunction(signature(ys="numeric", Xs="numeric"), src, plugin="RcppArmadillo") This creates a compiled function fun which, by using Armadillo, regresses a vector ys on a matrix Xs (just how the fastLmPure() function in the package does) --- yet is constructed on the fly using cxxfunction from inline. More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Tue, 08 Jun 2010
Rcpp 0.8.1
There are a few fairly visible new things in this release. As we want to focus the next few minor releases on completing the documentation, we started by adding a total of four (!!) new vignettes:
The most interesting new feature is what we call Rcpp modules and is modeled after Boost::Python. This makes it pretty easy to expose C++ functions and classes to R -- without having to write glue code. This is pretty new and may change a tad over the coming releases, but it is also quite exciting. Other changes concern more improvements for use of inline which should now allow packages like our RcppArmadillo to be used with it, and some bug fixes. The full NEWS entry for this release follows below:
0.8.1 2010-06-08
o This release adds Rcpp modules. An Rcpp module is a collection of
internal (C++) functions and classes that are exposed to R. This
functionality has been inspired by Boost.Python.
Modules are created internally using the RCPP_MODULE macro and
retrieved in the R side with the Module function. This is a preview
release of the module functionality, which will keep improving until
the Rcpp 0.9.0 release.
The new vignette "Rcpp-modules" documents the current feature set of
Rcpp modules.
o The new vignette "Rcpp-package" details the steps involved in making a
package that uses Rcpp.
o The new vignette "Rcpp-FAQ" collects a number of frequently asked
questions and answers about Rcpp.
o The new vignette "Rcpp-extending" documents how to extend Rcpp
with user defined types or types from third party libraries. Based on
our experience with RcppArmadillo
o Rcpp.package.skeleton has been improved to generate a package using
an Rcpp module, controlled by the "module" argument
o Evaluating a call inside an environment did not work properly
o cppfunction has been withdrawn since the introduction of the more
flexible cxxfunction in the inline package (0.3.5). Rcpp no longer
depends on inline since many uses of Rcpp do not require inline at
all. We still use inline for unit tests but this is now handled
locally in the unit tests loader runTests.R.
Users of the now-withdrawn function cppfunction can redefine it as:
cppfunction <- function(...) cxxfunction( ..., plugin = "Rcpp" )
o Support for std::complex was incomplete and has been enhanced.
o The methods XPtr
As always, even fuller details are in 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, 03 Jun 2010
inline 0.3.5
This is some ways a continuation of the 0.3.4 release I had made in December. That release had opened the door for the wide use of inline in our Rcpp package. And just how Rcpp has grown, we now have needs beyond the initial change. See the post on Romain's blog for details, but in a nutshell we are now gaining
Last but not least, our thanks to Oleg Sklyar for letting us extend his amazing inline package for use by Rcpp. Mon, 31 May 2010
Bike The Drive 2010
/sports/cycling | permanent link
JPM Chase Corporate Challenge 2010
This time we all got chip-timing via a small (rfid ?) strip tagged to back of the bib number. Which is handy as I managed to not stop my time by hand correctly. Given that I am still nursing a sore Achilles tendon and don't train well or much, the time of 23:51 (or 6:48 min/mile) was ok compared to the other seven previous times I have run this. /sports/running | permanent link Thu, 27 May 2010
WU Wien presentations
On Friday, I also gave an informal lecture / tutorial / workshop to some of the Stats and Finance Ph.D. students, drawing largely from the section on parallel computing of the most recent Introduction to High-Performance Computing with R tutorial. My sincere thanks to Kurt Hornik and Stefan Theussl for the invite -- it was a great trip, notwithstanding the mostly unseasonally cold and wet weather. Thu, 20 May 2010
RcppArmadillo 0.2.0 (and 0.2.1)
This new release offers a number of key improvements:
While we had tested this quite rigourously, the combination of some last minute changes that were meant to be stylistic-only, some troubles with the tests and builds at CRAN that were not apparent in all our tests (hint: do not yet use dynamic help features referencing other packages even if you have a Depends: on them) and an upcoming travel deadline meant that we missed a gotcha on Windows---so release 0.2.1 had to follow a few hours after the short-lived 0.2.0. More information is on the RcppArmadillo page. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page. Mon, 17 May 2010
Rcpp 0.8.0
This release brings a number of changes that are detailed below. Of particular interest may be the much more robust treatment of exceptions, the new classes for data frames and formulae, and the availability of the new helper function cppfunction for use with inline. Also of note is the new support for the 'LinkingTo' directive with which packages using Rcpp will get automatic access to the header files. An announcement email went to the r-packages list (ETH Zuerich, Gmane); Romain also blogged about the release. The full NEWS entry for this release follows below:
0.8.0 2010-05-17
o All Rcpp headers have been moved to the inst/include directory,
allowing use of 'LinkingTo: Rcpp'. But the Makevars and Makevars.win
are still needed to link against the user library.
o Automatic exception forwarding has been withdrawn because of
portability issues (as it did not work on the Windows platform).
Exception forwarding is still possible but is now based on explicit
code of the form:
try {
// user code
} catch( std::exception& __ex__){
forward_exception_to_r( __ex___ ) ;
}
Alternatively, the macro BEGIN_RCPP and END_RCPP can use used to enclose
code so that it captures exceptions and forward them to R.
BEGIN_RCPP
// user code
END_RCPP
o new __experimental__ macros
The macros RCPP_FUNCTION_0, ..., RCPP_FUNCTION_65 to help creating C++
functions hiding some code repetition:
RCPP_FUNCTION_2( int, foobar, int x, int y){
return x + y ;
}
The first argument is the output type, the second argument is the
name of the function, and the other arguments are arguments of the C++
function. Behind the scenes, the RCPP_FUNCTION_2 macro creates
an intermediate function compatible with the .Call interface and handles
exceptions
Similarly, the macros RCPP_FUNCTION_VOID_0, ..., RCPP_FUNCTION_VOID_65
can be used when the C++ function to create returns void. The generated
R function will return R_NilValue in this case.
RCPP_FUNCTION_VOID_2( foobar, std::string foo ){
// do something with foo
}
The macro RCPP_XP_FIELD_GET generates a .Call compatible function that
can be used to access the value of a field of a class handled by an
external pointer. For example with a class like this:
class Foo{
public:
int bar ;
}
RCPP_XP_FIELD_GET( Foo_bar_get, Foo, bar ) ;
RCPP_XP_FIELD_GET will generate the .Call compatible function called
Foo_bar_get that can be used to retrieved the value of bar.
The macro RCPP_FIELD_SET generates a .Call compatible function that
can be used to set the value of a field. For example:
RCPP_XP_FIELD_SET( Foo_bar_set, Foo, bar ) ;
generates the .Call compatible function called "Foo_bar_set" that
can be used to set the value of bar
The macro RCPP_XP_FIELD generates both getter and setter. For example
RCPP_XP_FIELD( Foo_bar, Foo, bar )
generates the .Call compatible Foo_bar_get and Foo_bar_set using the
macros RCPP_XP_FIELD_GET and RCPP_XP_FIELD_SET previously described
The macros RCPP_XP_METHOD_0, ..., RCPP_XP_METHOD_65 faciliate
calling a method of an object that is stored in an external pointer. For
example:
RCPP_XP_METHOD_0( foobar, std::vector
As always, even fuller details are in 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, 26 Apr 2010
R Project and Google Summer of Code: Welcome to our students!
Date: Mon, 26 Apr 2010 15:27:29 -0500 To: R Development List /computers/misc | permanent link Wed, 21 Apr 2010
Boston Marathon 2010
Which seems to have worked. My pace was more even, and I conserved some energy and made it past the last of the hills around mile 21 without walking a single step while staying a few second under a 8 min/mile average pace. But then around mile 23 and 24 I had two sharp short cramps which forced me to walk. Interestingly enough, Bob Richards writes about cramps as a main theme for many runners in this year's race. Maybe the wind and temperature combined with the hills to get us after all! Anyway, I ended up with 3:29:14 which, at a 7:59 pace, is right between the 2007 and 2009 results and quite decent given the circumstances. And of course the weekend as whole was again a hoot even if I had only a short stay of around 30 hours in Boston given our R/Finance conference on Friday and Saturday. We'll see if I will manage to qualify once more for next year. /sports/running | permanent link Tue, 20 Apr 2010
R / Finance 2010 presentations
As a co-organizer, it was a great pleasure to see so many users of R in Finance---from both industry and academia---come to Chicago to discuss and share recent work. There is a lot going on, and it is always good to exchange ideas with others sharing the same infrastructure. Participants appeared to enjoy the conference. My thanks to everybody who helped to put it together, from the local committee to the helping hands at UIC and of course the sponsors. I just put my slides from the Extending and Embedding R with C++ tutorial preceding the conference, as well as the RQuantLib: Interfacing QuantLin from R presentation (with Khanh Nguyen), up onto my presentations page. I do have a usb-drive with all conference presentations and will provide them via the R / Finance site in a few days. The only truly sour note is the fact that several presenters from Europe had their travels schedules turned upside down by the disruption to international air travel caused by the Icelandic volcano eruption and the resulting ash clouds. While we are glad to have had them for a little longer in Chicago, we understand that they are getting eager to return home. I hope this extended stay in the Windy City does not take away from the overall usefulness of the trip. Fri, 16 Apr 2010
Rcpp 0.7.12
This is another bug-fix version related solely to a build failure on Windows. Trying to protect paths with spaces has the side-effect of breaking backticks use, which unfortunately is already in use by a number of package that since broke during CRAN autobuilds. No other changes were made.
As always, full details are in 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, 07 Apr 2010
Video of UCLA / LA RUG talk on R and C++ integration
Thanks also to David Smith (at the REvolutions blog) and Drew Conway (at his blog) for spreading the word about the presentation video and slides -- quite a few folks have come to my presentations page to get them. Sun, 04 Apr 2010
UCLA and LA RUG talks on R and C++ integration
The talks centered around R and C++ integration using both Rcpp and RInside and summarise where both projects stand after all the recent work Romain and I put in over the last few months. The presentations went fairly well; I received some favourable comments. Szilard and the R User Group had also suggested a group discussion about CRAN, its growth and how to maximise its usefulness. Given my CRANberries feed, my work on the CRAN Task Views for Empirical Finance and High-Performance Computing with R as well as our cran2deb binary package generator, I had some views and ideas that helped frame the discussion which turned out to very useful and informed. So maybe we should do this User Group thing in Chicago too! Special thanks to Jan de Leeuw and Szilard Pafka for organising the meeting, talks and discussion. Fri, 26 Mar 2010
Finance::YahooQuote 0.24
Anyway, a new version 0.24 of Finance::YahooQuote which addresses the issue that required upload 0.23 yesterday is now in the Debian queue and on CPAN and my local yahooquote page. This time it may even work. A big thanks to the CPAN Testers for getting me reports on this one too. /computers/linux/debian/packages | permanent link
Rcpp 0.7.11
This version fixes a somewhat serious bug uncovered by Doug Bates when working with vectors of strings. We also added a few new accessor functions as well as a new convenience function create that is particularly useful for creating (possibly named) list objects that are returned to R. Here is the full NEWS entry for this release:
0.7.11 2010-03-26
o Vector<> gains a set of templated factory methods "create" which
takes up to 20 arguments and can create named or unnamed vectors.
This greatly facilitates creating objects that are returned to R.
o Matrix now has a diag() method to create diagonal matrices, and
a new constructor using a single int to create square matrices
o Vector now has a new fill() method to propagate a single value
o Named is no more a class but a templated function. Both interfaces
Named(.,.) and Named(.)=. are preserved, and extended to work also on
simple vectors (through Vector<>::create)
o Applied patch by Alistair Gee to make ColDatum more robust
o Fixed a bug in Vector that caused random behavior due to the lack of
copy constructor in the Vector template
As always, even fuller details are in 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, 25 Mar 2010
Finance::YahooQuote 0.23
Which lead the automated Perl test scripts to remind me for a few days now that the full company name for symbol IBM no longer corresponded to what I had encoded. Not really a bug, but a failure in tests anyway. So without further ado: a new version 0.23 of Finance::YahooQuote which addressed this issue is now in the Debian queue and on CPAN and my local yahooquote page. /computers/linux/debian/packages | permanent link Mon, 22 Mar 2010
RInside release 0.2.2
RInside is a set of convenience classes to facilitate embedding of R inside of C++ applications. It works particularly well with Rcpp and now depends on it. This is the first release since version 0.2.1 in early January. Romain and I made numerous changes to Rcpp in the meantime. With this release, RInside is starting to catch up by taking advantage of many new automatic (templated) type converters. We have updated the existing examples, and added several new ones. These are all visibile directly via the Doxygen-generated documentation under the Files heading. Two examples are also shown directly on the RInside page. Also added are new examples showing how to use RInside to embed R inside C++ applications using MPI for parallel computing. This was contributed via two examples files by Jianping Hua, and we reworked the examples slightly (and added two variants that use MPI's C++ API). As it is so short, here is the basic 'Hello, World' example now showing the simpler Rcpp-based variable assignment: // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8; -*- // // Simple example showing how to do the standard 'hello, world' using embedded R // // Copyright (C) 2009 Dirk Eddelbuettel // Copyright (C) 2010 Dirk Eddelbuettel and Romain Francois // // GPL'ed #include <RInside.h> // for the embedded R via RInside int main(int argc, char *argv[]) { RInside R(argc, argv); // create an embedded R instance R["txt"] = "Hello, world!\n"; // assign a char* (string) to 'txt' R.parseEvalQ("cat(txt)"); // eval the init string, ignoring any returns exit(0); } One minor setback is that the examples currently segfault on Windows. That may be an issue with linking and class instantiation or something related. Romain and I focus much more on Linux and OS X, so this has not gotten a lot of attention. Debugging help would be appreciated. /code/rinside | permanent link Sun, 21 Mar 2010
2010 March Madness Half Marathon in Cary
As for the race conditions, we had fantastic weather all week with temperatures up to the sixties and then all of a sudden a forecast of rain, snow and even sleet for the weekend. Luckily, and while yesterday was sucky, today was allright or better. A little chilly and damp, but neither rain nor snow --- or even wind. So the conditions were good, with the course challenging as usual. The race itself went fine. I ran more or less steadily, never had to stop but was not particularly fast at 1:39:38 or a pace of 7:36.3. I had aimed for beating 1:40, had missed that target by miles 4 to 6 and was about 10 or 15 seconds behind but managed to get a negative split on the second half of the course to reach that goal. Which is nice, but the time is still the slowest I've ever run that race, and my slowest half-marathon since 2004. Training had been sluggish all winter. Oddly enough, already in last year's post I stated pretty much the same and feared that Boston may become tough --- which it did. But this year may well be a lot worse as I had no spring in my step all winter long. No fire in the belly for training will make for a long race. We'll see how it goes. Four weeks to go. /sports/running | permanent link Thu, 18 Mar 2010
R Project selected for the Google Summer of Code 2010
An R Wiki page had been created and serves as the central
point of reference for the R Project
and the GSoC 2010. It contains a list of project ideas, currently counting
eleven and spanning everything from research-oriented topics (such as spatial
statistics or automatic differentiation) to R community-support (regarding
CRAN statistics and the CRANtastic site) to extensions (NoSQL, RPy2 data interfaces, Rserve browser integration) and more. I also just created a
mailing list /computers/misc | permanent link Mon, 15 Mar 2010
Rcpp 0.7.10
We also put two small improvements in, see the full NEWS entry for this release:
0.7.10 2010-03-15
o new class Rcpp::S4 whose constructor checks if the object is an S4 object
o maximum number of templated arguments to the pairlist function,
the DottedPair constructor, the Language constructor and the
Pairlist constructor has been updated to 20 (was 5) and a script has been
added to the source tree should we want to change it again
o use shQuotes() to protect Windows path names (which may contain spaces)
As always, even fuller details are in 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 Fri, 12 Mar 2010
Rcpp 0.7.9
So a quick bug-fix release 0.7.9 is now in Debian and should be on CRAN shortly. The full NEWS entry for this release follows:
0.7.9 2010-03-12
o Another small improvement to Windows build flags
o bugfix on 64 bit platforms. The traits classes (wrap_type_traits, etc)
used size_t when they needed to actually use unsigned int
o fixed pre gcc 4.3 compatibility. The trait class that was used to
identify if a type is convertible to another had too many false positives
on pre gcc 4.3 (no tr1 or c++0x features). fixed by implementing the
section 2.7 of "Modern C++ Design" book.
As always, even fuller details are in 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 Update: First version number corrected to 0.7.8. Thu, 11 Mar 2010
RcppArmadillo 0.1.0
Romain and I already had an example of a simple but fast linear model fit using the (very clever) Armadillo C++ library by Conrad Sanderson. In fact, I had used this as a motivational example of why Rcpp rocks in a recent talk to the ACM chapter at U of Chicago which, thanks to David Smith at REvo, got some further exposure. Now this example is more refined as further glue got added. Given that both Armadillo and Rcpp make use of C++ templates, the actual amount of code in RcppArmadillo is not that large: just over 200 lines in a header file, and a little less for some testing accessor and example functions in a source file. And this makes for some really nice example code: the 'fast regression' example becomes this (where I simply removed two blocks with conditional on the Armadillo version):
#include <RcppArmadillo.h> extern "C" SEXP fastLm(SEXP ys, SEXP Xs) { Rcpp::NumericVector yr(ys); // creates Rcpp vector from SEXP Rcpp::NumericMatrix Xr(Xs); // creates Rcpp matrix from SEXP int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); // reuses memory and avoids extra copy arma::colvec y(yr.begin(), yr.size(), false); arma::colvec coef = solve(X, y); // fit model y ~ X arma::colvec resid = y - X*coef; // residuals double sig2 = arma::as_scalar( trans(resid)*resid/(n-k) ); // std.error of estimate arma::colvec stderrest = sqrt( sig2 * diagvec( arma::inv(arma::trans(X)*X)) ); Rcpp::Pairlist res(Rcpp::Named( "coefficients", coef), Rcpp::Named( "stderr", stderrest)); return res; } No extra copies! Armadillo instantiates directly from the underlying R objects for the vector and matrix, solves the regression equations, computes the standard error of the estimates and returns the two vectors. Leaving us to write about eleven lines of code. Moreover, as Armadillo is well designed and uses template meta-programming to avoid extra copies (see these lecture notes for details), it is about as efficient as it can be (and will use Atlas or other BLAS where available). And, this is just one example. Rcpp should be suitable for other C++ libraries, and provides an easy to use seamless interface between C++ and R. However, we should note that (at about the last minute) we found out about some unit test failures in OS X as well as some issues in a Debian chroot -- cran2deb ran into some build issues on i386 and amd64 in the testing chroot even this 'it all works' swimmingly on our Debian, Ubuntu and Fedora build environments. A follow-up with fixes for either Rcpp and/or RcppArmadillo appears likely. Update: The build issues seems to be with 64-bit systems and everything appears cool in 32-bit. Wed, 10 Mar 2010
RcppExamples 0.1.0
As mentioned in the post about release 0.7.8 of Rcpp, Romain and I carved this out of Rcpp itself to provide a cleaner separation of code that implements our R / C++ interfaces (which remain in Rcpp) and code that illustrates how to use it --- which is now in RcppExamples. This also provides an easier template for people wanting to use Rcpp in their packages as it will be easier to wrap one's head around the much smaller RcppExamples package. A simple example (using the newer API) may illustrate this: #include <Rcpp.h> RcppExport SEXP newRcppVectorExample(SEXP vector) { Rcpp::NumericVector orig(vector); // keep a copy (as the classic version does) Rcpp::NumericVector vec(orig.size()); // create a target vector of the same size // we could query size via // int n = vec.size(); // and loop over the vector, but using the STL is so much nicer // so we use a STL transform() algorithm on each element std::transform(orig.begin(), orig.end(), vec.begin(), sqrt); Rcpp::Pairlist res(Rcpp::Named( "result", vec), Rcpp::Named( "original", orig)); return res; } With essentially five lines of code, we provide a function that takes any numeric vector and returns both the original vector and a tranformed version---here by applying a square root operation. Even the looping along the vector is implicit thanks to the generic programming idioms of the Standard Template Library. Nicer still, even on misuse, exceptions get caught cleanly and we get returned to the R prompt without any explicit coding on the part of the user:
R> library(RcppExamples) Loading required package: Rcpp R> print(RcppVectorExample( 1:5, "new" )) # select new API $result [1] 1.000 1.414 1.732 2.000 2.236 $original [1] 1 2 3 4 5 R> RcppVectorExample( c("foo", "bar"), "new" ) Error in RcppVectorExample(c("foo", "bar"), "new") : not compatible with INTSXP R> There is also analogous code for the older API in the package, but it is about three times as long, has to loop over the vector and needs to set up the execption handling explicitly. As of right now, RcppExamples does not document every class but it should already provide a fairly decent start for using Rcpp. And many more actual usage examples are ... in the over two-hundred unit tests in Rcpp. Update: Now actually showing new rather than classic API. Tue, 09 Mar 2010
Rcpp 0.7.8
This is a minor feature release based on a over three weeks of changes that are summarised below in the extract from the NEWS file. Some noteworthy highlights are
The full NEWS entry for this release follows:
0.7.8 2010-03-09
o All vector classes are now generated from the same template class
Rcpp::Vector
As always, even fuller details are in the ChangeLog on 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 Update: Two links corrected. Thu, 25 Feb 2010
R and Sudoku solvers: Plus ca change...
But what everybody seems to be forgetting is that R has had a Sudoku solver for years, thanks to the sudoku package by David Brahm and Greg Snow which was first posted four years ago. What comes around, goes around. With that, and about one minute of Emacs editing to get the Le Monde puzzle into the required ascii-art form, all we need to do is this:
That took all of five seconds while my computer was also compiling a particularly resource-hungry C++ package....R> library(sudoku) R> s <- readSudoku("/tmp/sudoku.txt") R> s [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 8 0 0 0 0 1 2 0 0 [2,] 0 7 5 0 0 0 0 0 0 [3,] 0 0 0 0 5 0 0 6 4 [4,] 0 0 7 0 0 0 0 0 6 [5,] 9 0 0 7 0 0 0 0 0 [6,] 5 2 0 0 0 9 0 4 7 [7,] 2 3 1 0 0 0 0 0 0 [8,] 0 0 6 0 2 0 1 0 9 [9,] 0 0 0 0 0 0 0 0 0 R> system.time(solveSudoku(s)) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 8 4 9 6 7 1 2 5 3 [2,] 6 7 5 2 4 3 9 1 8 [3,] 3 1 2 9 5 8 7 6 4 [4,] 1 8 7 4 3 2 5 9 6 [5,] 9 6 4 7 8 5 3 2 1 [6,] 5 2 3 1 6 9 8 4 7 [7,] 2 3 1 8 9 4 6 7 5 [8,] 4 5 6 3 2 7 1 8 9 [9,] 7 9 8 5 1 6 4 3 2 user system elapsed 5.288 0.004 5.951 R> Just in case we needed another illustration that it is hard to navigate the riches and wonders that is CRAN... Thu, 18 Feb 2010
U of C ACM talk
Rcpp 0.7.7
0.7.7 2010-02-14
o new template classes Rcpp::unary_call and Rcpp::binary_call
that facilitates using R language calls together
with STL algorithms.
o fixed a bug in Language constructors taking a string as their
first argument. The created call was wrong.
As always, even fuller details are in the ChangeLog on the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Sat, 13 Feb 2010
Rcpp 0.7.6
The changes are summarised below in the NEWS file snippet, more details are in the ChangeLog as well.
0.7.6 2010-02-12
o SEXP_Vector (and ExpressionVector and GenericVector, a.k.a List) now
have methods push_front, push_back and insert that are templated
o SEXP_Vector now has int- and range-valued erase() members
o Environment class has a default constructor (for RInside)
o SEXP_Vector_Base factored out of SEXP_Vector (Effect. C++ #44)
o SEXP_Vector_Base::iterator added as well as begin() and end()
so that STL algorithms can be applied to Rcpp objects
o CharacterVector gains a random access iterator, begin() and end() to
support STL algorithmsl; iterator dereferences to a StringProxy
o Restore Windows build; successfully tested on 32 and 64 bit;
o Small fixes to inst/skeleton files for bootstrapping a package
o RObject::asFoo deprecated in favour of Rcpp::as
As always, even fuller details are in the ChangeLog on the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Tue, 09 Feb 2010
Rcpp 0.7.5
The changes are summarised below in the NEWS file snippet, more details are in the ChangeLog as well.
0.7.5 2010-02-08
o wrap has been much improved. wrappable types now are :
- primitive types : int, double, Rbyte, Rcomplex, float, bool
- std::string
- STL containers which have iterators over wrappable types:
(e.g. std::vector
As always, even fuller details are in the ChangeLog on the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Fri, 05 Feb 2010
R / Finance 2010 Open for Registration
See you in Chicago in April! Wed, 03 Feb 2010
RProtoBuf 0.1-0
RProtoBuf had a funny start. I had blogged about the 12 hour passage from proof of concept to R-Forge project following the ORD session hackfest in October. What happened next was as good. Romain emailed within hours of the blog post and reminded me of a similar project that is part of Saptarshi Guha's RHIPE R/Hadoop implementation. So the three of us--Romain, Saptarshi and I---started emailing and before long it becomes clear that Romain is both rather intrigued by this (whereas Saptarshi has slightly different needs for the inner workings of his Hadoop bindings) and was able to devote some time to it. So the code kept growing and growing at a fairly rapid clip. Til that stopped as we switched to working feverishly on Rcpp to both support the needs of this project, and to implement ideas we had while working on this. That now lead to the point where Rcpp is maturing in terms of features, so we will probably have time come back to more work on RProtoBuf to take advantage of the nice templated autoconversions we now have in Rcpp. Oddly enough, the initial blog post seemed to anticipate changes in Rcpp.
Anyway --
RProtoBuf
is finally here and it already does a fair amount of magic based of code reflection
using the R> library( RProtoBuf ) ## load the package R> readProtoFiles( "addressbook.proto" ) ## acquire protobuf information R> bob <- new( tutorial.Person, ## create new object + email = "bob@example.com", + name = "Bob", + id = 123 ) R> writeLines( bob$toString() ) ## serialize to stdout name: "Bob" id: 123 email: "bob@example.com" R> bob$email ## access and/or override [1] "bob@example.com" R> bob$id <- 5 R> bob$id [1] 5 R> serialize( bob, "person.pb" ) ## serialize to compact binary format There is more information at the RProtoBuf page, and we already have a draft package vignette, a 'quick' overview vignette and a unit test summary vignette. More changes should be forthcoming as Romain and I find time to code them up. Feedback is as always welcome. /code/rprotobuf | permanent link Sun, 31 Jan 2010
Rcpp 0.7.4
The release once again combines a number of necessary fixes with numerous new features:
Lastly, we had a remaining Windows build issue. Also, Brian Ripley and Uwe Ligges kindly sent us a small patch supporting the new Windows 64-bit builds using the new MinGW 64-bit compiler for Windows -- so release 0.7.5 may follow in due course. The NEWS file entry for release 0.7.4 is as follows:
0.7.4 2010-01-30
o matrix matrix-like indexing using operator() for all vector
types : IntegerVector, NumericVector, RawVector, CharacterVector
LogicalVector, GenericVector and ExpressionVector.
o new class Rcpp::Dimension to support creation of vectors with
dimensions. All vector classes gain a constructor taking a
Dimension reference.
o an intermediate template class "SimpleVector" has been added. All
simple vector classes are now generated from the SimpleVector
template : IntegerVector, NumericVector, RawVector, CharacterVector
LogicalVector.
o an intermediate template class "SEXP_Vector" has been added to
generate GenericVector and ExpressionVector.
o the clone template function was introduced to explicitely
clone an RObject by duplicating the SEXP it encapsulates.
o even smarter wrap programming using traits and template
meta-programming using a private header to be include only
RcppCommon.h
o the as template is now smarter. The template now attempts to
build an object of the requested template parameter T by using the
constructor for the type taking a SEXP. This allows third party code
to create a class Foo with a constructor Foo(SEXP) to have
as
As always, even fuller details are in the ChangeLog on the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page Thu, 21 Jan 2010
Rcpp 0.7.3
This release combines a number of under-the-hood fixes and enhancements with one bug fix:
As always, full details are in the ChangeLog on the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page /computers/linux/debian/packages | permanent link Thu, 14 Jan 2010
RQuantLib 0.3.2 released
This versions brings a few cleanups due to minor
Rcpp changes (in
essence: we now define the macro It also adds a number of calendaring and holiday utilities that Khanh just added: tests for weekend, holiday, endOfMonth as well dayCount, date advancement and year fraction functions commonly used in fixed income. Full changelog details, examples and more details about this package are at my RQuantLib page. /computers/linux/debian/packages | permanent link Tue, 12 Jan 2010
Rcpp 0.7.2
A lot of the momentum for the new API is continuing, thanks in large part to Romain. A number of new classes have been added, and existing ones have been enhanced. There are more unit tests than ever, and more documentation. We have better build support (with g++ version detection so that we can add some C++0x support where available) and a new examples sub-directory. We did take one toy away, though. The Doxygen-generated docs were getting so big that we decided to keep them out of the source tarball. (And arguably, they are also too volatile.) We still have the browseable html docs as well as the pdf version (now at over 300 pages!). And we added zip archives of the docs in html, latex, and man format for download. As always, full details are in the ChangeLog on the Rcpp page. Questions, comments etc: bring them to the rcpp-devel mailing list off the R-Forge page /computers/linux/debian/packages | permanent link Thu, 07 Jan 2010
Review of 'Computational Statistics: An Introduction to R' in JSS
RInside release 0.2.1
This is a maintenance release building on the recent
0.2.0 release
which added Windows support (provided you use the Rtools toolchain for
Windows). In this release, we changed the startup initialization so that
The new release should hit CRAN mirrors tomorrow, and is (as always) available from my machine too. /computers/linux/debian/packages | permanent link Tue, 05 Jan 2010
littler 0.1.3
littler provides This version adds a few minor behind-the-scenes improvements:
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. /computers/linux/debian/packages | permanent link Sat, 02 Jan 2010
Rcpp 0.7.1
A lot has changed under the hood since 0.7.0, and this is the first release that really reflects many of Romain's additions. Some of the changes are
/computers/linux/debian/packages | permanent link Mon, 28 Dec 2009
inline 0.3.4 released
A new release of Rcpp will probably follow in due course as we can now depend on this new inline version; Romain has also put nice new code in around exceptions and we may add some more on external pointers. Good times ... /computers/linux/debian/packages | permanent link Wed, 23 Dec 2009
Beancounter minor bug fix release 0.8.9
/computers/linux/debian/packages | permanent link Tue, 22 Dec 2009
RInside release 0.2.0
The biggest news is that we now support builds on Windows -- if and only
if you use the R toolchain -- more on that below. Since I had first released
RInside people
had emailed about support on Windows. However, Richard Holbrey deserves
special mention as he actually sat down and tried to build it. Over a few
email exchanges we made decent progress, but stalled. More recently, I
sat down and had another go and lo and behold, it works. This required a few
Now, to make this plain: you need
That said, if you have the proper tools, things are peachy. Install the
package, change into the Happy embedding! /computers/linux/debian/packages | permanent link Sun, 20 Dec 2009
Rcpp and inline example
The following R code defines a character
variable ## now use Rcpp to pass down a parameter for the seed, and a vector size gslrng <- ' int seed = RcppSexp(s).asInt(); int len = RcppSexp(n).asInt(); gsl_rng *r; gsl_rng_env_setup(); std::vector<double> v(len); r = gsl_rng_alloc (gsl_rng_default); gsl_rng_set (r, (unsigned long) seed); for (int i=0; i<len; i++) { v[i] = gsl_rng_get (r); } gsl_rng_free(r); return RcppSexp(v).asSexp(); ' ## turn into a function that R can call ## compileargs redundant on Debian/Ubuntu as gsl headers are found anyway funx <- cfunction(signature(s="numeric", n="numeric"), gslrng, includes="#include <gsl/gsl_rng.h>", Rcpp=TRUE, cppargs="-I/usr/include", libargs="-lgsl -lgslcblas") print(funx(0, 5))
The As the R level, we now have a function of two arguments returning a vector of RNG draws of the given lenth and using the given seed.
Also note how we tell Finally, we simply call our freshly compiled, linked and loaded C++ function with arguments zero for the seed and five for the length, and print the results vector returned to R from C++. /computers/linux/debian/packages | permanent link Sat, 19 Dec 2009
Rcpp 0.7.0
This release has a couple new features :
/computers/linux/debian/packages | permanent link |
|||||