Passing matrix or vector objects to gsl_statistic routines.
Mike Benton
bikepunk005@hotmail.com
Mon Sep 8 03:06:00 GMT 2003
Hi,
Is it possible to use a matrix or vector object, say gsl_matrix *dta or
gsl_vector *vdta, and pass it to any of the gsl_statistic routines.
For example:
dta is populated with data.
double get_skew (int variable) {
double skew;
skew = gsl_stats_skew (dta[variable], 1, number_of_cases);
return skew;
}
or
void get_regression (int x, int y) {
double c0, c1, cov00, cov01, cov11, chisq;
gsl_fit_linear (dta[x], 1, dta[y], 1, number_of_cases,
&c0, &c1, &cov00, &cov01, &cov11,
&chisq);
printf ("# best fit: Y = %g + %g X\n", c0, c1);
printf ("# covariance matrix:\n");
printf ("# [ %g, %g\n# %g, %g]\n",
cov00, cov01, cov01, cov11);
printf ("# chisq = %g\n", chisq);
}
I have been trying and have had no success. My desire is to pass the object
to the routine without creating an array.
I am programming in C on Linux, using version 1.4 of GSL. Lastly, I am
re-new at c (I stopped programming in 92 and I have just started programming
again.).
Thanks for you help,
Mike H. Benton
More information about the Gsl-discuss
mailing list