From r.d.morey at rug.nl  Tue Jul 14 20:10:52 2009
From: r.d.morey at rug.nl (Richard D. Morey)
Date: Tue, 14 Jul 2009 20:10:52 +0200
Subject: [Rd] matrix algebra in c
In-Reply-To: <mailman.19.1247565606.18918.r-devel@r-project.org>
References: <mailman.19.1247565606.18918.r-devel@r-project.org>
Message-ID: <4A5CCA2C.8000109@rug.nl>

I'd like to use some matrix algebra in my c code that is called from R.
I need matrix multiplication, transposition, and Cholesky decomposition.
I haven't come across any easy way to do this, but from browsing the web
and R-devel a few options come to mind:

1. use F77_CALL() to call matrix multiplication functions from blas.
This should be ok as long as I remember that c and FORTRAN store
matrices differently.

2. include gsl code and link against the gsl binaries? This seems like
it would cause problems compiling it on different systems.

3. write my own code (bad idea)

4. Call R from my C code (slow?)

What's the best/easiest way? I don't really care how the matrices are
represented in c (could be gsl_matrix, SEXP, whatever) as long as it works.

Thanks,
Richard Morey



[Rd] matrix algebra in c
Richard D. Morey