Skip to main content

SMCTC: Sequential Monte Carlo Template Class and RcppSMC

Sequential Monte Carlo methods are a very general class of Monte Carlo methods for sampling from sequences of distributions. Simple examples of these algorithms (often termed particle filters) are used very widely in the tracking and signal processing literature. Recent developments illustrate that these techniques have much more general applicability, and can be applied very effectively to statistical inference problems. Unfortunately, these methods are often perceived as being computationally expensive and difficult to implement. This library seeks to address both of these problems.

A C++ template class library for the efficient and convenient implementation of very general Sequential Monte Carlo algorithms (or general particle interpretations of Feynman-Kac formulae) is presented. Two example applications are provided: a simple particle filter for illustrative purposes and a state-of-the-art algorithm for rare event estimation.

This software is released under version 3 of the GNU General Public License.

Please be aware that this software is still in development, although all known bugs have been eliminated it is possible that some persist. If you wish to be added to a mailing list to receive information about updates to this software, then please send an email to the author, a dot m dot johansen at warwick dot ac dot uk. Otherwise, please check this page regularly for updates.

I'd be very glad to receive any comments, criticisms or suggestions that you may have for the software, particularly if you have experience of implementing algorithms using the library. Again, feel free to email me at a dot m dot johansen at warwick dot ac dot uk.


The library itself (presently version 1.01 We're currently working fairly actively on RcppSMC hence the lack of obvious development of the main libraray- essentially identical to RC4) is available in source format. It has been tested under a number of versions of Linux using GCC-3, GCC-4 and GCC-5, including Ubuntu, Gentoo and SuSe. It has also been successfully used under Windows, compiled using Microsoft Visual C++ 5 Express. It is also reported to work using Dev-C++ under windows.

The software makes use of the GNU Scientific library, this is available from the main GNU software page. Windows users may be interested in Microsoft Visual C ports in source and binary form -- these can be found at David Geldreich's page (MSVC 2003) and Brian Gladman's page (MSVC 2008). Guidelines on the use of GSL with Dev-C++ can be found at QuantCode.


The tutorial and user guide should be considered the primary source of information about SMCTC.

Here is a complete list of changes since previous releases. RC2 saw a bug in the resampling code fixed, and wrappers for a number of additional random number generators added. Another bug which prevented residual resampling from function correctly was fixed in RC3 -- please update to the latest version. RC4 sees a number of technical improvements to the library, some of which should improve the robustness of developed code and others should help compilation with a range of diffrent compilers. Relase 1.01 fixes a bug in the sampler constructor.

Citing SMCTC

Should you wish to refer to SMCTC, then please cite the JSS article:

  author =	"Adam M. Johansen",
  title =	"SMCTC: Sequential Monte Carlo in C++",
  journal =	"Journal of Statistical Software",
  volume =	"30",
  number =	"6",
  pages =	"1--41",
  month =	"4",
  year = 	"2009",
  ISSN = 	"1548-7660",
  URL =  	"",

Applications of SMCTC

RcppSMC is an R package which provides access to the functionality of SMCTC within the R environment, making extensive use of the Rcpp package (Eddelbuettel and Francois, 2011, J Statistical Software, 40:8) to achieve this. This is currently the direction in which SMCTC is being actively developed.

Fallon, Johannsson and Leonard (2012, in proceedings of ICRA) use SMCTC in a robot-localisation context

If you make use of SMCTC and would like me to add a link to your project/paper here then send me an email at a dot m dot johansen at warwick dot ac dot uk.

SMC Resources

This section summarises a few resources which may be helpful to people new to SMC or related topics.
Here are some particle-filtering references which might be helpful to people new to the area:

General SMC references are listed by: