Displaying 3 results from an estimated 3 matches for "gsl_matrix_get".
2006 Dec 24
2
FW: Passing lists from R to C, extracting elements, and sending lists back again
...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(1);
return (r);
}
2004 Feb 19
1
Obtaining SE from the hessian matrix
...a should I use in _this_ case?
Well, some times ago I had a glance at gsl, GNU Scientific Library. It
use converted-to-C MINPACK for NLS fit too. And, in the GSL ref. manual
example
http://www.gnu.org/software/gsl/manual/html_node/gsl-ref_36.html#SEC475
SE calculated as
#define ERR(i) sqrt(gsl_matrix_get(covar,i,i))
where covar = (J^T * J)^-1 (i.e. how in the second formulae above).
So, what is the _right_ way for obtatining SE? Why two those formulas above
differ?
Thank you!
--
WBR,
Timur.
2007 Jan 04
1
Parameter changes and segfault when calling C code through .Call
...Chol = gsl_matrix_alloc(k, k); // define matrix that will store Chol decomp
gsl_matrix_memcpy(sigmaChol, sigma);
gsl_linalg_cholesky_decomp(sigmaChol);
// compute logdet of sigma by 2*sum of log of diagomal elements of chol decomp
for (i=0; i<k; i++) {
logdetSigma = logdetSigma + log(gsl_matrix_get(sigmaChol,i,i));
}
logdetSigma = 2*logdetSigma;
// compute (beta-mean)' sigma^(-1) (beta-mean)
gsl_vector * x = gsl_vector_alloc(k);
2: // gsl_matrix_fprintf(stdout,sigma,"%f");
gsl_vector_memcpy(x, beta);
gsl_vector_sub(x, betaMean); // beta - betaMean
gsl_vector...