From ripley at stats.ox.ac.uk  Sun Apr  6 14:53:14 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun, 6 Apr 2008 13:53:14 +0100 (BST)
Subject: [Rd] Matrix multiplication in a C code
In-Reply-To: <47F8C62C.7010501@epfl.ch>
References: <47F8C62C.7010501@epfl.ch>
Message-ID: <alpine.LFD.1.00.0804061350410.9702@auk.stats.ox.ac.uk>

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



[Rd] Matrix multiplication in a C code
Prof Brian Ripley