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

From: Dirk Eddelbuettel <>
Date: Thu 01 Sep 2005 - 07:46:07 EST

Ott Toomet <otoomet <at>> 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 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 (

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 mailing list PLEASE do read the posting guide! Received on Thu Sep 01 07:56:26 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:10:04 EST