search for: gsl_matrix_set

Displaying 1 result from an estimated 1 matches for "gsl_matrix_set".

Did you mean: gsl_matrix_get
2006 Dec 24
2
FW: Passing lists from R to C, extracting elements, and sending lists back again
...hes, Michael Braun MIT Sloan School of Management braunm at mit.edu SEXP r = PROTECT(allocVector(VECSXP,n)); double rm[k][k]; for (i=0; i<n; i=i+1) { for (a=0; a<k; ++a){ // convert to gsl matrix for (b=0; b<k; ++b){ ind = b*k + a; m = REAL(VECTOR_ELT(list,i))[ind]; gsl_matrix_set(mat, b, a, m); } } // end conversion loops gsl_linalg_LU_decomp(mat, p, &s); gsl_linalg_LU_invert(mat, p, inv); for (a=0; a<k; ++a){ // convert from gsl matrix for (b=0; b<k; ++b){ rm[b][a] = gsl_matrix_get(inv,b,a); } } SET_VECTOR_ELT(r, i, rm); } UNPROTECT...