Dirk Eddelbuettel: Rcpp 0.9.0 announcement
The text below went out as a post to the
r-packages list a few days ago, but I thought it would make sense to post it
on the blog too. So with a little html markup...
Summary
Version 0.9.0 of the Rcpp package is now on CRAN and its mirrors. This
release marks another step in the development of the package, and a few key
points are highlighted below. More details are in the NEWS and ChangeLog
files included in the package.
Overview
Rcpp is an R package and associated C++ library that facilitates integration
of C++ code in R packages.
The package features a complete set of C++ classes (Rcpp::IntegerVector,
Rcpp:NumericVector, Rcpp::Function, Rcpp::Environment, ...) that makes it
easier to manipulate R objects of matching types (integer vectors, functions,
environments, etc ...).
Rcpp takes advantage of C++ language features such as the explicit
constructor / destructor lifecycle of objects to manage garbage collection
automatically and transparently. We believe this is a major improvement over
use of PROTECT / UNPROTECT. When an Rcpp object is created, it protects the
underlying SEXP so that the garbage collector does not attempt to reclaim the
memory. This protection is withdrawn when the object goes out of
scope. Moreover, users generally do not need to manage memory directly (via
calls to new / delete or malloc / free) as this is done by the Rcpp classes
or the corresponding STL containers.
A few key points about Rcpp:
- a rich API covering all core R data types including vectors, matrices, functions, environments, ... (with the exeception of factors which are less useful in C++)
- seamless (bi-directional) data interchange between R and C++
- possibility of inline use permitting definition, compilation, linking and loading of C++ functions directly from R
- extensive documentation now covering eight vignettes
- exception handling and error propagation back to R
- extensive test suite using RUnit covering over 700 tests
- extension packages RcppArmadillo and RcppGSL provide easy-to-use integration with the Armadillo (linear algebra) and GNU GSL librasries
- increasing adoption among R users and package developers with now twenty packages from CRAN or BioConductor depending on Rcpp
- support for the legacy 'classic' Rcpp is now provided by the RcppClassic package which is being released concurrently with Rcpp 0.9.0
which deploys the sugar 'ifelse' function modeled after the corresponding R function. Another simple example isSEXP foo( SEXP xx, SEXP yy) NumericVector x(xx), y(yy) ; return ifelse( x < y, x*x, -(y*y) ) ;
where use the sugar function 'sapply' to sweep a simple C++ function which operates elementwise across the supplied vector. The Rcpp-sugar vignette describes sugar in more detail. Rcpp modules Rcpp modules are inspired by Boost.Python and make exposing C++ functions or classes to R even easier. A first illustration is provided by this simple C++ code snippetdouble square( double x) return x*x ; SEXP foo( SEXP xx ) NumericVector x(xx) ; return sapply( x, square ) ;
which (after compiling and loading) we can access in R asconst char* hello( const std::string& who ) std::string result( "hello " ) ; result += who ; return result.c_str() ; RCPP_MODULE(yada) using namespace Rcpp ; function( "hello", &hello ) ;
In a similar way, C++ classes can be exposed very easily. Rcpp modules are also described in more detail in their own vignette. Reference Classes R release 2.12.0 introduced Reference Classes. These are formal S4 classes with the corresponding dispatch method, but passed by reference and easy to use. Reference Classes can also be exposed to R by using Rcpp modules. Extension packackages The RcppArmadillo package permits use of the advanced C++ library 'Armadillo, a C++ linear algebra library aiming towards a good balance between speed and ease of use, providing integer, floating point and complex matrices and vectors with lapack / blas support via R. Armadillo uses templates for a delayed evaluation approach is employed (during compile time) to combine several operations into one and reduce (or eliminate) the need for temporaries. Armadillo is useful if C++ has been decided as the language of choice, rather than another language like Matlab or Octave, and aims to be as expressive as the former. Via Rcpp and RcppArmadillo, R users now have easy access to this functionality. Examples are provided in the RcppArmadillo package. The RcppGSL package permits easy use of the GNU Scientific Library (GSL), a collection of numerical routines for scientifc computing. It is particularly useful for C and C++ programs as it provides a standard C interface to a wide range of mathematical routines such as special functions, permutations, combinations, fast fourier transforms, eigensystems, random numbers, quadrature, random distributions, quasi-random sequences, Monte Carlo integration, N-tuples, differential equations, simulated annealing, numerical differentiation, interpolation, series acceleration, Chebyshev approximations, root-finding, discrete Hankel transforms physical constants, basis splines and wavelets. There are over 1000 functions in total with an extensive test suite. The RcppGSL package provides an easy-to-use interface between GSL data structures and R using concepts from Rcpp. The RcppGSL package also contains a vignette with more documentation. Legacy 'classic' API Packages still using code interfacing the initial 'classic' Rcpp API are encouraged to migrate to the new API. Should a code transition not be possible, backwards compatibility is provided by the RcppClassic package released alongside Rcpp 0.9.0. By including RcppClassic.h and building against the RcppClassic package and library, vintage code can remain operational using the classic API. The short vignette in the RcppClassic package has more details. Documentation The package contains a total of eight vignettes the first of which provides a short and succinct introduction to the Rcpp package along with several motivating examples. Links Support Questions about Rcpp should be directed to the Rcpp-devel mailing list https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-develyada <- Module( "yada" ) yada$hello( "world" )
Dirk Eddelbuettel, Romain Francois, Doug Bates and John Chambers
December 2010
If you are having trouble connecting to the Internet using your Nokia N900 as a 3G modem with Network Manager, you should
I m loving it. Right now I m playing
Viewsonic provided a patch to Nvidia's reference Tegra code to support their gtablet today. Which is progress! They still don't have anything for their (entirely unrelated) Viewpad Android devices, and there's no source for the userspace components, but there does seem to be a reasonable desire to do the right thing and I'm sure everything else will be sorted out soon. This still puts them ahead of Augen, who have now been violating since July and seem to be entirely at the mercy of their OEM vendor who'll sell them devices but won't give them source. Top tip: Don't buy Linux devices from companies who won't give you source code and then resell them, it tends to leave you open to all kinds of legal misery and then your children get poorly carved lumps of wood for Christmas. Don't make your children think that you're an inept parent. Pay attention to licensing obligations.

The
My OpenWrt box has for some time connected
Reading up on apxs2.
debian/patches/076_apxs2_a2enmod.dpatch seems to make apxs2 use mods-available, but then when I make an apache module and install, it doesn't help me make the file.
A couple of months ago, Debian project membership
About a week ago, I bought me a 

In such cases, most people use to say "never saw this" and such common
sentences.
However, really, this time this is true: it's now 30 years since I live
in the Paris area, a place where climate is not known to be a snowy
one: Paris and its region are not that far from the Channel and the
influence of Atlantic Ocean is supposedly important. And, really, I
never saw this.
For such reasons, here, winters are not really "continental" and we
often have few snow during an entire winter, if any. Indeed, during
the 200* years, we had several winters without any snow at all.
Last year was already different: we had 3 snow episodes. A quite big
one on Dec 17th (about 15cm in the western area of the region),
another in mid-January where snow lasted for about one week because of
very low temperatures (below -10 C) and a final one in February.
Still, the 2010-2011 winter is something I never saw before. In less
than one month, we had 6 different snow episodes: Nov 28th (roughly),
Dec 8th, Dec 17th, Dec 18th, Dec 20th and now Dec 22th. My area (the
western part of the region) was hardly hit with 20cm on Dec 8th and
about 15cm on Dec 20th and 22th....up to a cumulated 80cm height.
Really something unusual. And what that happens in a region where
about 12M people live, sometimes at rush hours, you can expect a giant
mess (and a giant mess it was on Dec 8th).
During these weeks, I personnally experimented my new way of
commuting: run/train/run, which means running the 3km desert country road
from my house to the train station, catching a train, then running the
final 4km in suburbs close to Paris. Both runs do actually replace a
standard bus ride. This prove to be convenient as buses are often
stopped during snow episodes (hey, there are hills in the Paris
area!).
That made things that I'll really remember for the future: this
morning's run in the country with 15cm of fresh snow, without any
single step mark (except the rabbit or wild pig ones), with the light
of my head lamp, no noise and an entirely white landscape....is
special and nearly unique when you live only 30km away from the town.
Nevertheless, that might prefigure what we will experience in the
upcoming years or dozen of years: a generally much colder winter over
western Europe, much closer to what Central Europe always
had. Personnally, I like that, but we probably need to prepare our
facilities to such events: last week-end in UK, Belgium, France,
Germany, etc. was really a giant mess (Heathrow airport closed, Roissy
nearly closed, Brussels flooded with derouted planes, Frankfurt stuck,
Eurostars stopped, gee). Is that climate change (as a consequence of
Gulf Stream vanishing) or just a collection of random events? We'll
see.
Cube-mate and friend,