help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] how to covert from gsl_vector to double array for input t


From: Brian Gough
Subject: Re: [Help-gsl] how to covert from gsl_vector to double array for input to gsl_stats functions
Date: Sun, 06 Jul 2008 21:36:54 +0100
User-agent: Wanderlust/2.14.0 (Africa) Emacs/22.1 Mule/5.0 (SAKAKI)

At Sat, 5 Jul 2008 11:07:42 -0500,
Michael Chen wrote:
> 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);

A column vector has a non-unit stride so the appropriate usage is
mean[i]=gsl_stats_mean(column.vector.data,column.vector.stride,m);

-- 
Brian Gough

GNU Scientific Library -
http://www.gnu.org/software/gsl/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]