/[pspp]/pspp/lib/linreg/linreg.c
ViewVC logotype

Diff of /pspp/lib/linreg/linreg.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by jstover, Sun Oct 30 15:06:18 2005 UTC revision 1.6 by jstover, Mon Nov 28 03:17:00 2005 UTC
# Line 139  pspp_linreg (const gsl_vector * Y, const Line 139  pspp_linreg (const gsl_vector * Y, const
139    gsl_vector_view xty;    gsl_vector_view xty;
140    gsl_vector_view xi;    gsl_vector_view xi;
141    gsl_vector_view xj;    gsl_vector_view xj;
142      gsl_vector *param_estimates;
143    
144    size_t i;    size_t i;
145    size_t j;    size_t j;
# Line 300  pspp_linreg (const gsl_vector * Y, const Line 301  pspp_linreg (const gsl_vector * Y, const
301        /*        /*
302           Use QR decomposition via GSL.           Use QR decomposition via GSL.
303         */         */
304    
305          param_estimates = gsl_vector_alloc (1 + X->size2);
306        design = gsl_matrix_alloc (X->size1, 1 + X->size2);        design = gsl_matrix_alloc (X->size1, 1 + X->size2);
307    
308        for (j = 0; j < X->size1; j++)        for (j = 0; j < X->size1; j++)
# Line 313  pspp_linreg (const gsl_vector * Y, const Line 316  pspp_linreg (const gsl_vector * Y, const
316          }          }
317        gsl_multifit_linear_workspace *wk =        gsl_multifit_linear_workspace *wk =
318          gsl_multifit_linear_alloc (design->size1, design->size2);          gsl_multifit_linear_alloc (design->size1, design->size2);
319        rc = gsl_multifit_linear (design, Y, cache->param_estimates,        rc = gsl_multifit_linear (design, Y, param_estimates,
320                                  cache->cov, &(cache->sse), wk);                                  cache->cov, &(cache->sse), wk);
321          for (i = 0; i < cache->n_coeffs; i++)
322            {
323              cache->coeff[i].estimate = gsl_vector_get (param_estimates, i);
324            }
325        if (rc == GSL_SUCCESS)        if (rc == GSL_SUCCESS)
326          {          {
327            gsl_multifit_linear_free (wk);            gsl_multifit_linear_free (wk);
328              gsl_vector_free (param_estimates);
329          }          }
330        else        else
331          {          {

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26