[R] "best" c++ matrix library?

Dirk Eddelbuettel edd at debian.org
Wed Aug 31 23:46:07 CEST 2005


Ott Toomet <otoomet <at> ut.ee> writes:
> I am planning to write some more time-consuming matrix manipulations
> in c++.  What is the experience with the existing c++ matrix
> libraries?  Do you have some recommendations?  Are some libraries more
> compatible with R than the others?

A loooong time ago, I used to use the newmat C++ library by Robert Davies -- 
see http://www.robertnz.net/nm_intro.htm which states 
    "This C++ library is intended for scientists and engineers who need to
     manipulate a variety of types of matrices using standard matrix operations.
     Emphasis is on the kind of operations needed in statistical calculations
     such as least squares, linear equation solve and eigenvalues."

In fact, my use even lead to a short review about newmat and g++ for the Journal 
of Applied Econometrics (http://dirk.eddelbuettel.com/papers/gccnewmat.ps.gz).

Robert has continued to maintain, support and extend newmat. I would probably 
start there if I needed a C++ Matrix library as newmat is (in no order of 
preference)
-- fairly small (unlike Boost)
-- as I recall, doesn't depend on anything else
-- well documented 
-- well tested
-- pretty "clean" conceptually

Moreover, Robert really is a statistician so there may be interest on his side
in tieing newmat to R if were to provide some prototypes. 

But this really is a question of programming style and preferences, and mine
certainly changed in the meantime so take this with the usual spoon of salt.

Hope this helps,  Dirk




More information about the R-help mailing list