[Rd] Matrix multiplication in a C code

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Apr 6 14:53:14 CEST 2008

On Sun, 6 Apr 2008, Mathieu Ribatet wrote:

>    Dear list members,
> I've got a small question on matrix multiplications in a C code. Because
> of a really cpu demanding likelihood, I had to use a C code within an R
> function wrapper. I'm pretty sure that there is already one good code
> for matrix multiplication in C - maybe in the R source code itself - but
> I wasn't able to find it.
> Anyone as an idea on how to handle matrix multiplications?

Well, R does use fast C code where available: see matmult in 
src/main/array.c which calls the BLAS.  It works best if you have an 
optimized BLAS: otherwise it may not be as fast as the simple version used 
when there are NAs present.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list