Displaying 3 results from an estimated 3 matches for "gsl_matrix".
Did you mean:
glmatrix
2007 Jan 04
1
Parameter changes and segfault when calling C code through .Call
...as.double(mu),sig, as.integer(6))
print(sig) # sig has changed after .Call
This code takes the SEXP's that were passed from R and converts them to gsl objects, and then calls the logpdf function:
# include <R.h>
# include <Rinternals.h>
# include <Rmath.h>
# include <gsl/gsl_matrix.h>
# include <gsl/gsl_vector.h>
# include <gsl/gsl_blas.h>
# include <gsl/gsl_linalg.h>
# include <gsl/gsl_math.h>
SEXP R_mvnorm_logpdf (SEXP xx, SEXP mux, SEXP sigmax, SEXP kx) {
int k = INTEGER(kx)[0];
double * xAr = REAL(xx);
double * muAr = REAL(mux);
dou...
2009 Jul 14
1
matrix algebra in c
...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
2005 Dec 25
4
Portability and Memory Issues for R-package
...virtually no progress. I have noticed similar issues in the past when calling Winbugs repeatedly using Gelmans functions, so it is likely not an issue that is coming just from my code.
I suspect that the memory issues could have something to do with the fact that my C code makes repeated use of the gsl_matrix_alloc and gsl_matrix_free functions rather than the R_alloc function (I suspect that the memory is not Garbage collected). I searched the web and found the following suggestion from Bryan Gouch in response to a similar question posted on the gsl discussion forum.
"If you want to return an R...