[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] how to covert from gsl_vector to double array for input to gs
From: |
Michael Chen |
Subject: |
[Help-gsl] how to covert from gsl_vector to double array for input to gsl_stats functions |
Date: |
Sat, 5 Jul 2008 11:07:42 -0500 |
Dear there,
I am reading a dataset into a two dimensional array, and trying to
calculate the columnwise mean of it. The result is a disaster. It
seems that the column.vector.data is not the first column I wanted.
Since most gsl_stats functions need input of double array or matrices,
I would like to know how you deal with this situation. Please cc my
email address as well, thanks!
double data[m][n];
FILE * in = fopen("kenneth48monthvalueweight.dat","r");
gsl_matrix_fscanf(in,&vdata.matrix);
gsl_matrix_view vdata = gsl_matrix_view_array (data[0],m,n);
for (i=0;i<n;i++){
gsl_vector_view column = gsl_matrix_column (&vdata.matrix, i);
mean[i]=gsl_stats_mean(column.vector.data,1,m);
}
--
Best regards,
Mike
- [Help-gsl] how to covert from gsl_vector to double array for input to gsl_stats functions,
Michael Chen <=