Package RcppEigen. February 15, 2013

Similar documents
Package retrosheet. April 13, 2015

Package fastghquad. R topics documented: February 19, 2015

Package PACVB. R topics documented: July 10, Type Package

Package MBA. February 19, Index 7. Canopy LIDAR data

Package ChannelAttribution

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Package biganalytics

Package uptimerobot. October 22, 2015

Package bigdata. R topics documented: February 19, 2015

Package wordcloud. R topics documented: February 20, 2015

6. Cholesky factorization

Package decompr. August 17, 2016

α = u v. In other words, Orthogonal Projection

Linear Algebra Review. Vectors

Typical Linear Equation Set and Corresponding Matrices

Package urltools. October 11, 2015

Eigen. a c++ linear algebra library. Gaël Guennebaud. [ Séminaire Aristote 15 May 2013

Package MDM. February 19, 2015

Package tagcloud. R topics documented: July 3, 2015

Package R4CDISC. September 5, 2015

7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix

Package EstCRM. July 13, 2015

Lecture 5: Singular Value Decomposition SVD (1)

Numerical Methods I Solving Linear Systems: Sparse Matrices, Iterative Methods and Non-Square Systems

Package RCassandra. R topics documented: February 19, Version Title R/Cassandra interface

Continued Fractions and the Euclidean Algorithm

Introduction to parallel computing in R

Package missforest. February 20, 2015

Matrix Algebra in R A Minimal Introduction

Package plan. R topics documented: February 20, 2015

Review Jeopardy. Blue vs. Orange. Review Jeopardy

Package dsmodellingclient

Supplementary PROCESS Documentation

3 Orthogonal Vectors and Matrices

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

Package erp.easy. September 26, 2015

Package TSfame. February 15, 2013

Package GSA. R topics documented: February 19, 2015

Solving Linear Systems, Continued and The Inverse of a Matrix

Package EasyHTMLReport

Object systems available in R. Why use classes? Information hiding. Statistics 771. R Object Systems Managing R Projects Creating R Packages

Package fimport. February 19, 2015

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

Package HHG. July 14, 2015

by the matrix A results in a vector which is a reflection of the given

Linearly Independent Sets and Linearly Dependent Sets

Package mcmcse. March 25, 2016

1 Introduction to Matrices

Orthogonal Diagonalization of Symmetric Matrices

Notes on Determinant

Package packrat. R topics documented: March 28, Type Package

Data Mining: Algorithms and Applications Matrix Math Review

Package bigrf. February 19, 2015

Step by Step Tutorial to creating R Packages. Heng Wang Michigan State University

Package changepoint. R topics documented: November 9, Type Package Title Methods for Changepoint Detection Version 2.

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

Mehtap Ergüven Abstract of Ph.D. Dissertation for the degree of PhD of Engineering in Informatics

CS 5614: (Big) Data Management Systems. B. Aditya Prakash Lecture #18: Dimensionality Reduc7on

Linear Algebra: Determinants, Inverses, Rank

Package robfilter. R topics documented: February 20, Version 4.1 Date Title Robust Time Series Filters

Recall that two vectors in are perpendicular or orthogonal provided that their dot

Package cgdsr. August 27, 2015

Applied Linear Algebra I Review page 1

Package jrvfinance. R topics documented: October 6, 2015

Epipolar Geometry. Readings: See Sections 10.1 and 15.6 of Forsyth and Ponce. Right Image. Left Image. e(p ) Epipolar Lines. e(q ) q R.

Package trimtrees. February 20, 2015

Linear Algebraic Equations, SVD, and the Pseudo-Inverse

Package ggrepel. February 8, 2016

CHAPTER 8 FACTOR EXTRACTION BY MATRIX FACTORING TECHNIQUES. From Exploratory Factor Analysis Ledyard R Tucker and Robert C.

Lecture 2 Matrix Operations

Package sjdbc. R topics documented: February 20, 2015

Package httprequest. R topics documented: February 20, 2015

MONTE-CARLO SIMULATION OF AMERICAN OPTIONS WITH GPUS. Julien Demouth, NVIDIA

is in plane V. However, it may be more convenient to introduce a plane coordinate system in V.

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

Using row reduction to calculate the inverse and the determinant of a square matrix

APPM4720/5720: Fast algorithms for big data. Gunnar Martinsson The University of Colorado at Boulder

Matrix Multiplication

Package HadoopStreaming

Row Echelon Form and Reduced Row Echelon Form

Similarity and Diagonalization. Similar Matrices

The Geometry of Polynomial Division and Elimination

Writing R packages. Tools for Reproducible Research. Karl Broman. Biostatistics & Medical Informatics, UW Madison

AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS

Package ATE. R topics documented: February 19, Type Package Title Inference for Average Treatment Effects using Covariate. balancing.

Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances

Similar matrices and Jordan form

MATH 423 Linear Algebra II Lecture 38: Generalized eigenvectors. Jordan canonical form (continued).

Package hive. January 10, 2011

x = + x 2 + x

Transcription:

Package RcppEigen February 15, 2013 Type Package Title Rcpp integration for the Eigen templated linear algebra library. Version 0.3.1.2.1 Date 2013-01-14 Author Douglas Bates, Romain Francois and Dirk Eddelbuettel Maintainer Douglas Bates <bates@stat.wisc.edu> Description R and Eigen integration using Rcpp. Eigen is a C++ template library for linear algebra: matrices, vectors,numerical solvers and related algorithms. It supports dense and sparse matrices on integer, floating point and complex numbers, decompositions of such matrices, and solutions of linear systems. Its performance on many algorithms is comparable with some of the best implementations based on Lapack and level-3 BLAS. The RcppEigen package includes the header files from the Eigen C++ template library (currently version 3.1.0). Thus users do not need to install Eigen itself in order to use RcppEigen. Eigen is licensed under the GNU LGPL version 3 or later, and also under the GNU GPL version 2 or later. RcppEigen (the Rcpp bindings/bridge to Eigen) is licensed under the GNU GPL version 2 or later, as is the rest of Rcpp. License GPL (>= 2) Depends Rcpp (>= 0.10.1), Matrix (>= 1.0-1), R(>= 2.14.0) LazyLoad yes LinkingTo Rcpp Imports Matrix Suggests inline, RUnit, testthat URL http://eigen.tuxfamily.org 1

2 fastlm Repository CRAN Date/Publication 2013-02-04 08:02:53 NeedsCompilation yes R topics documented: RcppEigen-package..................................... 2 fastlm............................................ 2 RcppEigen.package.skeleton................................ 5 Index 7 RcppEigen-package Rcpp/Eigen bridge Description The package eases the use of the Eigen C++ template library for linear algebra with Rcpp Details This package contains the header files for the Eigen C++ template library. The typical usage is to install this package and list it in the LinkingTo: line in the DESCRIPTION file of other packages. The C++ source code and the R source code in this package are for illustration only. As described at the Eigen project s home page, http://eigen.tuxfamily.org, Eigen is a versatile, fast, reliable and elegant collection of C++ classes for linear algebra. References Douglas Bates and Dirk Eddelbuettel (2013). Fast and Elegant Numerical Linear Algebra Using the RcppEigen Package. Journal of Statistical Software, 52(5), 1-24. URL http://www.jstatsoft.org/v52/i05/. fastlm Bare-bones linear model fitting function Description fastlm estimates the linear model using one of several methods implemented using the Eigen linear algebra library.

fastlm 3 Usage fastlmpure(x, y, method = 0L) fastlm(x,...) ## Default S3 method: fastlm(x, y, method = 0L,...) ## S3 method for class formula fastlm(formula, data = list(), method = 0L,...) Arguments y X formula data Details Value method the response vector a model matrix... not used an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given in the Details section of the documentation for lm. an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called. an integer scalar with value 0 for the column-pivoted QR decomposition, 1 for the unpivoted QR decomposition, 2 for the LLT Cholesky, 3 for the LDLT Cholesky, 4 for the Jacobi singular value decomposition (SVD) and 5 for a method based on the eigenvalue-eigenvector decomposition of X X. Default is zero. Linear models should be estimated using the lm function. In some cases, lm.fit may be appropriate. The fastlmpure function provides a reference use case of the Eigen C++ template library via the wrapper functions in the RcppEigen package. The fastlm function provides a more standard implementation of a linear model fit, offering both a default and a formula interface as well as print, summary and predict methods. Internally the fastlm function, by default, uses a QR decomposition with column pivots, which is a rank-revealing decomposition, so that it can handle rank-deficient cases effectively. Other methods for determining least squares solutions are available according to the value of the method argument. An example of the type of situation requiring extra care in checking for rank deficiency is a twoway layout with missing cells (see the examples section). These cases require a special pivoting scheme of pivot only on (apparent) rank deficiency which is not part of conventional linear algebra software. fastlmpure returns a list with three components:

4 fastlm coefficients rank df.residual stderr s residuals fitted.values perm unsc a vector of coefficients a scalar denoting the computed rank of the model matrix a scalar denoting the degrees of freedom in the model a vector of the standard errors of the coefficient estimates a numeric scalar - the root mean square for residuals the vector of residuals the vector of fitted value the 0-based permutation vector from the QR decomposition the unscaled variance-covariance matrix. This is the inverse (or pseudo-inverse in the rank-deficient case when using a rank-revealing decomposition) of X X. fastlm returns a richer object which also includes the call argument similar to the lm or rlm functions.. Author(s) Eigen is described at http://eigen.tuxfamily.org. RcppEigen is written by Douglas Bates, Dirk Eddelbuettel and Romain Francois. References Douglas Bates and Dirk Eddelbuettel (2013). Fast and Elegant Numerical Linear Algebra Using the RcppEigen Package. Journal of Statistical Software, 52(5), 1-24. URL http://www.jstatsoft.org/v52/i05/. See Also lm, lm.fit Examples data(trees, package="datasets") mm <- cbind(1, log(trees$girth)) # model matrix y <- log(trees$volume) # response ## bare-bones direct interface flm <- fastlmpure(mm, y) print(flm) ## standard R interface for formula or data returning object of class fastlm flmmod <- fastlm( log(volume) ~ log(girth), data=trees) summary(flmmod) ## case where non-rank-revealing methods break down dd <- data.frame(f1 = gl(4, 6, labels = LETTERS[1:4]), f2 = gl(3, 2, labels = letters[1:3]))[-(7:8), ] xtabs(~ f2 + f1, dd) # one missing cell mm <- model.matrix(~ f1 * f2, dd) kappa(mm) # large, indicating rank deficiency set.seed(1)

RcppEigen.package.skeleton 5 dd$y <- mm %*% seq_len(ncol(mm)) + rnorm(nrow(mm), sd = 0.1) summary(lm(y ~ f1 * f2, dd)) # detects rank deficiency try(summary(fastlm(y ~ f1 * f2, dd))) # also detects rank deficiency RcppEigen.package.skeleton Create a skeleton for a new package that intends to use RcppEigen Description Usage RcppEigen.package.skeleton automates the creation of a new source package that intends to use features of RcppEigen. It is based on the package.skeleton function which it executes first. RcppEigen.package.skeleton(name = "anrpackage", list = character(), environment =.GlobalEnv, path = ".", force = FALSE, namespace = TRUE, code_files = character(), example_code = TRUE) Arguments name list environment path force namespace code_files example_code If TRUE, example C++ code using RcppEigen is added to the package Details In addition to package.skeleton : The DESCRIPTION file gains a Depends line requesting that the package depends on Rcpp and RcppEigen and a LinkingTo line so that the package finds Rcpp and RcppEigen header files. The NAMESPACE, if any, gains a usedynlib directive. The src directory is created if it does not exists and a Makevars file is added setting the environment variable PKG_LIBS to accomodate the necessary flags to link with the Rcpp library. If the example_code argument is set to TRUE, example files rcppeigen_hello_world.h and rcppeigen_hello_world.cpp are also created in the src. An R file rcppeigen_hello_world.r is expanded in the R directory, the rcppeigen_hello_world function defined in this files makes use of the C++ function rcppeigen_hello_world defined in the C++ file. These files are given as an example and should eventually by removed from the generated package.

6 RcppEigen.package.skeleton Value Nothing, used for its side effects References Read the Writing R Extensions manual for more details. Once you have created a source package you need to install it: see the R Installation and Administration manual, INSTALL and install.packages. See Also package.skeleton Examples ## Not run: RcppEigen.package.skeleton( "foobar" ) ## End(Not run)

Index Topic package RcppEigen-package, 2 Topic programming RcppEigen.package.skeleton, 5 Topic regression fastlm, 2 as.data.frame, 3 fastlm, 2 fastlmpure (fastlm), 2 formula, 3 INSTALL, 6 install.packages, 6 lm, 3, 4 lm.fit, 3, 4 package.skeleton, 5, 6 RcppEigen (RcppEigen-package), 2 RcppEigen-package, 2 RcppEigen.package.skeleton, 5 rlm, 4 7