[Rd] Matrix multiplication in a C code

Mathieu Ribatet mathieu.ribatet at epfl.ch
Mon Apr 14 00:00:53 CEST 2008

First, sorry for the delayed reply.

You were right matprod will do exactly what I want. Thanks. On another 
point, are you aware about a BLAS routine to test for semi-definite 
positive matrix ? This is required for my loglikelihood and thus should 
return -\infty if not.


Prof Brian Ripley a écrit :
> 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.

Institute of Mathematics
Ecole Polytechnique Fédérale de Lausanne
CH-1015 Lausanne   Switzerland
Tel: + 41 (0)21 693 7907

More information about the R-devel mailing list