Today a (slightly confused) question on
StackOverflow
wondered how to access R’s facilities for eigenvalues calculations
from C code.

For this, we need to step back and consider how this is done. In
fact, R farms the calculation out to the BLAS. On could possibly
access R’s functions—but would then have to wrestle with the data
input/output issues which make Rcpp shine in comparison. Also,
Rcpp gets us access to Armadillo (via the RcppArmadillo) package
and Armadillo’s main focus are exactly the linear algebra
calculations and decompositions.

And with facilities that were added to Rcpp in the 0.10.* release
series, this effectively becomes a one-liner of code! (Nitpickers
will note that there are also one include statement, two attributes
declarations and the function name itself.)

We can illustrate this easily via a random sample matrix.