R

tikzDevice v0.12.3

Yesterday tikzDevice version 0.12.3 made it unto CRAN and is now propagating to the mirrors. The tikzDevice package provides a graphics output device for R that records plots in a LaTeX-friendly format. The device transforms plotting commands issued by R functions into LaTeX code blocks. When included in a paper typeset by LaTeX, these blocks are interpreted with the help of TikZ—a graphics package for TeX and friends written by Till Tantau.

XY problems

One can easily fall for an XY problem even when one tries to avoid it.

Numerical integration over an infinite interval in Rcpp (part 2)

In a previous post I have shown that without intervention RcppNumerical does not handle integration over infinite ranges. In this post I want to generalize the method to integrals where only one of the limits is infinite. In addition, I want to make …

swephR v0.2.1

This morning swephR version 0.2.1 made it unto CRAN and is now propagating to the mirrors. The goal of swephR is to provide an R interface to the Swiss Ephemeris, a high precision ephemeris based upon the DE431 ephemeris from NASA’s JPL. It covers the time range 13201 BCE to 17191 CE. This new version comes closely after last week’s release and contains only a single albeit important fix to a stack overflow write found by the UBSAN tests done on CRAN.

swephR v0.2.0

This morning swephR version 0.2.0 made it unto CRAN and is now propagating to the mirrors. The goal of swephR is to provide an R interface to the Swiss Ephemeris, a high precision ephemeris based upon the DE431 ephemeris from NASA’s JPL. It covers the time range 13201 BCE to 17191 CE. The new version 0.2.0 brings two important changes. First, the version of the included Swiss Ephemeris has been updated to the current version 2.

Numerical integration over an infinite interval in Rcpp

On Stack Overflow the question was asked how to numerically integrate a function over a infinite range in Rcpp, e.g. by using RcppNumerical. As an example, the integral \[ \int_{-\infty}^{\infty} \mathrm{d}x \exp\left(-\frac{(x-\mu)^4}{2}\right) \] was given. Using RcppNumerical is straight forward. One defines a class that extends Numer::Func for the function and an interface function that calls Numer::integrate on it: // [[Rcpp::depends(RcppEigen)]] // [[Rcpp::depends(RcppNumerical)]] #include <RcppNumerical.h> class exp4: public Numer::Func { private: double mean; public: exp4(double mean_) : mean(mean_) {} double operator()(const double& x) const { return exp(-pow(x-mean, 4) / 2); } }; // [[Rcpp::export]] Rcpp::NumericVector integrate_exp4(const double &mean, const double &lower, const double &upper) { exp4 function(mean); double err_est; int err_code; const double result = Numer::integrate(function, lower, upper, err_est, err_code); return Rcpp::NumericVector::create(Rcpp::Named("result") = result, Rcpp::Named("error") = err_est); } This works fine for finite ranges:

RcppArrayFire v0.1.0: Sparse Matrices and support for Mac OS

The RcppArrayFire package provides an interface from R to and from the ArrayFire library, an open source library that can make use of GPUs and other hardware accelerators via CUDA or OpenCL. In order to use RcppArrayFire you will need the ArrayFire library and header files which you can build from source or use up-stream’s binary installer. See previous articles for a general introduction. Version 0.1.0 brings to important changes: Support for sparse matrices and Mac OS

dqrng v0.2.1

I have blogged about dqrng before, but I forgot to write about the v0.2.0 release, even though that brought a lot of changes including the fast sampling methods to CRAN: Add R side support for selecting multiple streams for parallel usage. Implement long_jump() for Xo(ro)shiro as alternative to jump() providing fewer streams with longer period. Handle R’s RNG scope properly during initialisation. New functions dqsample and dqsample.int using an unbiased sampling algorithm.