'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library

'Armadillo' is a templated C++ linear algebra library (by Conrad Sanderson) that aims towards a good balance between speed and ease of use. Integer, floating point and complex numbers are supported, as well as a subset of trigonometric and statistics functions. Various matrix decompositions are provided through optional integration with LAPACK and ATLAS libraries. The 'RcppArmadillo' package includes the header files from the templated 'Armadillo' library. Thus users do not need to install 'Armadillo' itself in order to use 'RcppArmadillo'. From release 7.800.0 on, 'Armadillo' is licensed under Apache License 2; previous releases were under licensed as MPL 2.0 from version 3.800.0 onwards and LGPL-3 prior to that; 'RcppArmadillo' (the 'Rcpp' bindings/bridge to Armadillo) is licensed under the GNU GPL version 2 or later, as is the rest of 'Rcpp'. Armadillo requires a C++11 compiler.

R and Armadillo via Rcpp


Armadillo is a templated C++ linear algebra library written by Conrad Sanderson that aims towards a good balance between speed and ease of use. Integer, floating point and complex numbers are supported, as well as a subset of trigonometric and statistics functions. Various matrix decompositions are provided through optional integration with LAPACK and ATLAS libraries.

A delayed evaluation approach is employed (during compile time) to combine several operations into one, and to reduce (or eliminate) the need for temporaries. This is accomplished through recursive templates and template meta-programming.

This library is useful if C++ has been decided as the language of choice (due to speed and/or integration capabilities), rather than another language.

The RcppArmadillo package includes the header files from the templated Armadillo library. Thus users do not need to install Armadillo itself in order to use RcppArmadillo.

This Armadillo integration provides a nice illustration of the capabilities of the Rcpp package for seamless R and C++ integration.


The package is under active development with releases to CRAN about once every other month, and widely-used by other CRAN packages as can be seen from the CRAN package page.


The package contains a pdf vignette which is a pre-print of the paper by Eddelbuettel and Sanderson in CSDA (2014), as well as an introductory vignette for the sparse matrix conversions.


Dirk Eddelbuettel, Romain Francois, Doug Bates and Binxiang Ni


GPL (>= 2)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("RcppArmadillo") by Dirk Eddelbuettel, 10 days ago

https://github.com/RcppCore/RcppArmadillo, https://dirk.eddelbuettel.com/code/rcpp.armadillo.html

Report a bug at https://github.com/RcppCore/RcppArmadillo/issues

Browse source code at https://github.com/cran/RcppArmadillo

Authors: Dirk Eddelbuettel , Romain Francois , Doug Bates and Binxiang Ni

Documentation:   PDF Manual  

Task views: Numerical Mathematics

GPL (>= 2) license

Imports Rcpp, stats, utils, methods

Suggests tinytest, Matrix, pkgKitten, reticulate, slam

Linking to Rcpp

Imported by Crossover, DiffusionRgqd, DiffusionRimp, DiffusionRjgqd, FLightR, PCPS, SYNCSA, conleyreg, highfrequency, malan, pirate, regmed, simPop, updog, vcpen.

Depended on by FisHiCal, MVB, PedCNV, robustgam.

Suggested by CFC, DepthProc, FSelectorRcpp, GPM, IBMPopSim, ManifoldOptim, MfUSampler, RcppProgress, bayesmove, collapse, crmPack, hdbinseg, lbfgsb3c, msde, parallelDist, psqn, r2sundials, themetagenomics, unsystation.

Linked to by ACEt, ADMM, ADMMsigma, ANN2, ARCokrig, ASPBay, ATAforecasting, AdaptiveSparsity, AlphaSimR, Amelia, AntMAN, BAMBI, BCEE, BCSub, BClustLonG, BGVAR, BHSBVAR, BIFIEsurvey, BLPestimatoR, BMTME, BNPMIXcluster, BNPmix, BOSSreg, BSSprep, BTLLasso, BVSNLP, BaBooN, BacArena, Barycenter, BayesComm, BayesESS, BayesMFSurv, BayesMRA, BayesMallows, BayesPPD, BayesRGMM, BayesReversePLLH, BayesSPsurv, BayesSUR, Bayesrel, BiProbitPartial, BigVAR, BoltzMM, BoostMLR, BosonSampling, Buddle, BuyseTest, CARlasso, CB2, CDM, CDSeq, CDatanet, CGGP, CLVTools, CPAT, CPGLIB, CVR, ChannelAttribution, CircSpaceTime, CircularDDM, ClusPred, ClusVis, ClusterR, CoOL, Compack, Countr, CovTools, CoxPlus, DCLEAR, DGM, DPWeibull, DSWE, DatAssim, DataVisualizations, DatabionicSwarm, DrImpute, DriftBurstHypothesis, DstarM, DtD, EAinference, ECctmc, EFAtools, EMMIXgene, EMVS, EMbC, EloChoice, EloRating, EstHer, EstMix, ExhaustiveSearch, FBFsearch, FDRreg, FKSUM, FMCCSD, FRESA.CAD, FSSF, FamilyRank, FarmSelect, FarmTest, FastBandChol, FastSF, FaultTree, GA, GADAG, GAS, GCSM, GDINA, GEEaSPU, GGMncv, GLMaSPU, GMCM, GMKMcharlie, GMMAT, GPCMlasso, GPFDA, GPvam, GPvecchia, GSE, GWmodel, GauPro, GeneralizedUmatrix, GenomeAdmixR, GenomicMating, GenomicTools, GiRaF, GiniDistance, Gmedian, GofKmt, GpGp, GreedyEPL, GxEScanR, HACSim, HARModel, HDSpatialScan, HLMdiag, HMB, HMMEsolver, HSAR, HTLR, HistDAWass, HypergeoMat, ICcalib, ICtest, IMAGE, IMaGES, IceCast, IncDTW, IrishDirectorates, JMI, JMbayes, JMbayes2, KernelICA, KernelKnn, KoulMde, L0Learn, LAM, Langevin, LassoGEE, LeMaRns, LinearDetect, Lmoments, LongMemoryTS, Luminescence, MABOUST, MAGEE, MAINT.Data, MAPITR, MAT, MAVE, MCMCprecision, MESS, MGMM, MHMM, MLModelSelection, MMVBVS, MNARclust, MRS, MSEtool, MSGARCH, MTLR, MatrixCorrelation, MatrixLDA, MetaheuristicFPA, MiSPU, MixMatrix, MomTrunc, Morpho, MrSGUIDE, MultOrdRS, MultSurvTests, MultiFit, NPflow, NetMix, NetRep, NetworkDistance, OpenImageR, PCMBaseCpp, PCMRS, PHSMM, PINSPlus, PLNmodels, PO.EN, POMaSPU, PPMR, PPforest, PPtreeViz, PQLseq, PRDA, PWD, PanelCount, PanelMatch, PenCoxFrail, Phase123, Phase12Compare, PhylogeneticEM, PieceExpIntensity, PoweR, Qtools, RJcluster, RLumCarlo, RLumModel, RNOmni, ROptSpace, RRI, RSSL, RStoolbox, Radviz, RcppDE, RcppDist, RcppDynProg, RcppEnsmallen, RcppHMM, RcppMLPACK, RcppSMC, Rdca, Rdimtools, RealVAMS, Rfast, Rfast2, Rforestry, Rfssa, RiemBase, Riemann, Rlda, Rlinsolve, RobGARCHBoot, Rphylopars, RprobitB, Rpvt, Rvcg, RxODE, SAGMM, SAMGEP, SAMM, SAR, SBSA, SBmedian, SC.MEB, SCORNET, SCPME, SFS, SHT, SLOPE, SMMA, SMME, SNPknock, SPlit, SSDL, SSLR, SSOSVM, STARTS, SVMMatch, SelvarMix, ShrinkCovMat, SimBIID, SimJoint, SimSurvNMarker, SpaCCr, SpaTimeClus, SparseFactorAnalysis, SparseLPM, SpatialBSS, SpatialEpi, SpatialTools, Spbsampling, SpecsVerification, SplitGLM, SplitReg, Sshaped, StempCens, StepwiseTest, StratifiedSampling, SubTite, SuperpixelImageSegmentation, SurrogateRegression, T4cluster, T4transport, TAG, TAM, TDAkit, TauStar, TestCor, TestDesign, TreeBUGS, TruncatedNormal, UComp, UPCM, UPG, UtilityFrailtyPH12, VARDetect, VARtests, VUROCS, VarSelLCM, WRI, WSGeometry, WaveSampling, WeibullR, ZVCV, abcrf, abn, acc, acebayes, activegp, afCEC, ahMLE, alpaca, anMC, apollo, arrApply, autocart, autostsm, avar, bama, bartBMA, bayesDP, bayesImageS, bayescopulareg, bayesm, bcROCsurface, bcf, bcp, beam, belg, betaBayes, beyondWhittle, bife, bigMap, bigReg, biglasso, bigsnpr, bigstatsr, bigtime, binGroup2, binaryGP, bisque, blatent, bliss, blockmodels, bmabasket, bootUR, bpgmm, bpnreg, briskaR, bssm, btb, bvarsv, bvartools, cIRT, cPCG, carat, catSurv, catlearn, ccaPP, cccp, cctools, cellWise, cglm, changepointsHD, chickn, circglmbayes, circumplex, cladoRcpp, cmenet, coala, coda.base, colorednoise, comat, communication, coneproj, conos, conquer, copCAR, cord, corrcoverage, covTestR, covglasso, coxrt, cpr, cpss, cqrReg, crandep, crawl, ctmcd, curveDepth, cytometree, dann, dccmidas, dcortools, dcov, dcurver, demu, densEstBayes, dexter, dexterMST, dfmta, dga, diagis, dina, dmbc, downscaledl, drgee, dscore, dtwclust, dynamichazard, dynmix, eBsc, eDMA, earthtide, edina, elmNNRcpp, emIRT, empichar, emstreeR, equateMultiple, ergmclust, ergmito, errum, esaddle, esreg, etm, eulerr, evgam, evolqg, exdex, expSBM, exuber, fDMA, fHMM, fICA, fabMix, factorstochvol, fastLink, fastM, fasterElasticNet, fasterize, fastmit, fastpos, fastshap, fclust, fctbases, fdaMixed, fdasrvf, filling, finity, fipp, flamingos, flan, fmerPack, fmf, forecast, fourPNO, fourierin, gMWT, gRain, gRbase, gRc, gRim, gamreg, gaselect, gasper, gbp, gcKrig, gdpc, geoFKF, geodiv, geogrid, geojsonR, gfiExtremes, gfilogisreg, ggdmc, gigg, gjam, glamlasso, glcm, goffda, goldi, gplite, graphicalVAR, graphlayouts, greed, gren, grove, growfunctions, grpsel, gsynth, harmony, hawkes, hawkesbow, hdbm, hdme, hdpGLM, heatwaveR, hesim, higlasso, hkevp, hpa, hsphase, hypervolume, iBATCGH, iccbeta, idefix, ideq, imbalance, immer, inca, infinitefactor, interep, interflex, intkrige, intsurv, ivdoctr, ivx, jSDM, jackalope, jmcm, jmotif, joineRML, jti, kdecopula, kernelPSI, l0ara, l1spectral, landscapemetrics, latentgraph, lavaSearch2, lazygreedy, ldsep, ldsr, lefko3, legion, leidenAlg, leontief, lidR, liger, lodr, lowmemtkmeans, lpirfs, lpme, ltsspca, ludic, lvmcomp, mDAG, maotai, markophylo, markovchain, mashr, mastif, matchingMarkets, matchingR, mcemGLM, mcglm, mclustcomp, mcmcse, mdgc, mdmb, meltt, meshed, metafolio, metapack, meteorits, mets, mev, mfbvar, mhazard, miceFast, miceadds, microsamplingDesign, milr, minerva, minimaxdesign, mirt, mirtCAT, mirtjml, missSBM, mixedCCA, mixedClust, mixedMem, mixsqp, mixture, mlpack, mlsbm, mmsample, mnlfa, modeLLtest, mombf, momentuHMM, motif, moveHMM, mp, mrf2d, mrfDepth, mrgsolve, msgl, mssm, multbxxc, multdyn, multgee, multinomineq, multivar, mvcluster, mvnfast, mvrsquared, myTAI, n1qn1, ncpen, netClust, netcontrol, netdiffuseR, netrankr, networkR, ngspatial, nlmixr, nlmm, nmslibR, nonlinearTseries, nprobust, obliqueRSF, odpc, oem, onlinePCA, onlineforecast, oppr, optiSel, ordinalClust, orthoDr, pGPx, pacotest, pagoda2, parglm, paropt, partition, pbv, pcalg, pcoxtime, pdSpecEst, pda, penPHcure, penalized, pense, perccal, perfectphyloR, pgee.mixed, pgsc, phenofit, phylosignal, phyr, planar, pleiotest, polyqtlR, porridge, ppgmmga, predkmeans, prioritizr, projpred, prospectr, prototest, proxyC, psd, psgp, psychonetrics, ptf, puniform, qbld, quadrupen, qualpalr, quanteda, quanteda.textmodels, quanteda.textstats, queuecomputer, qwraps2, rENA, rMVP, raceland, rags2ridges, ragt2ridges, ramcmc, rare, ratematrix, rayimage, rayshader, rbridge, rdist, reReg, reda, redist, registr, regnet, regsem, repolr, resemble, revdbayes, revealedPrefs, rhoR, riskRegression, rjpdmp, rliger, rmarchingcubes, rmgarch, rmi, roben, robregcc, robslopes, robustBLME, robustHD, robustreg, rocTree, roll, rollRegres, roptim, rotasym, rotations, rpms, rpql, rrpack, rrum, rsparse, rstpm2, rugarch, rust, s2net, saeRobust, samurais, sarima, sasfunclust, sbfc, sbm, sbmSDP, scDHA, scINSIGHT, sccore, scoringRules, sctransform, sdetorus, sdpdth, seagull, secure, seededlda, segMGarch, segclust2d, sensitivity, sensobol, sentometrics, seqHMM, seqest, sfcr, sgd, sglOptim, shapr, shrinkTVP, signnet, simcdm, simts, sirt, skm, slfm, smartsnp, smmR, smog, smoof, smooth, smoots, smurf, snpsettest, sommer, spBFA, spBayesSurv, spCP, spNetwork, spamtree, sparsereg, sparsevb, sparta, spatialwarnings, spduration, specs, spectralGraphTopology, spinBayes, splines2, splmm, spnn, springer, sprintr, sqp, srm, starma, statespacer, statgenGWAS, stcos, stm, stochvol, stplanr, stpm, strat, stratEst, strucchangeRcpp, sundialr, superml, support, surbayes, sureLDA, surveybootstrap, svars, symmetry, synlik, targeted, telefit, tensorBSS, textTinyR, textmineR, tfarima, tidylda, timma, trackdem, tree.interpreter, treeclim, treeducken, treenomial, tsBSS, tvR, uFTIR, ubms, unmarked, varband, vlad, wCorr, walker, waspr, weibulltools, womblR, wv, xdcclarge, yuima, zic, ziphsmm.

See at CRAN