[Top][All Lists]

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

Re: [Help-gsl] creating a submatrix from a matrix in a loop

From: George Kalema
Subject: Re: [Help-gsl] creating a submatrix from a matrix in a loop
Date: Tue, 16 Dec 2008 13:00:20 +0100

Brian, many thanks for your endavor to help. However, compiling my code
below returns error C2664: 'gsl_matrix_submatrix' : cannot convert parameter
1 from 'double *' to 'gsl_matrix *' Types pointed to are unrelated;
conversion requires reinterpret_cast, C-style cast or function-style cast.
Please note that parameter 1 (matrix X) is just read in (from SAS).

double f_jl(double* f_jl, double* X, int* many, int* freq)
        const int     p=many[0];
        const int     K=many[3];
        int begin = 1;
int ni, endi, i;

for (i =0; i < ptr_K; i++)    // loop for each subject
  ni = freq[ i ];
                 endi = begin + ( ni - 1 );
  gsl_matrix_view Xiview = gsl_matrix_submatrix (X, begin, 0, ni, p);
  gsl_matrix * Xi = gsl_matrix_alloc(ni, p);
  gsl_matrix_memcpy (Xi, &(Xiview.matrix));
  begin = endi + 1;    /*go to next subject's submatrix*/
 return 0;

reply via email to

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