X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Flinreg%2Flinreg.c;h=1fe4a79e5784aff1868c09e6c3d1aa56463508df;hb=f474cf35ed7d1a6374f187fb6ea4a32e00d0fa44;hp=dc7f1d0172933a581b017a830a489890120ec5cf;hpb=b9799cdd10b30ea96d9178b7a0d48504d052228c;p=pspp-builds.git diff --git a/lib/linreg/linreg.c b/lib/linreg/linreg.c index dc7f1d01..1fe4a79e 100644 --- a/lib/linreg/linreg.c +++ b/lib/linreg/linreg.c @@ -90,7 +90,6 @@ pspp_linreg_cache_alloc (size_t n, size_t p) pspp_linreg_cache *c; c = (pspp_linreg_cache *) malloc (sizeof (pspp_linreg_cache)); - c->param_estimates = gsl_vector_alloc (p + 1); c->indep_means = gsl_vector_alloc (p); c->indep_std = gsl_vector_alloc (p); c->ssx = gsl_vector_alloc (p); /* Sums of squares for the independent @@ -113,12 +112,18 @@ pspp_linreg_cache_alloc (size_t n, size_t p) void pspp_linreg_cache_free (pspp_linreg_cache * c) { - gsl_vector_free (c->param_estimates); + int i; + gsl_vector_free (c->indep_means); gsl_vector_free (c->indep_std); gsl_vector_free (c->ss_indeps); gsl_matrix_free (c->cov); - free (c->coeff); +#if 0 + for (i = 1; i < c->n_coeffs; i++) + { + pspp_linreg_coeff_free (c->coeff + i); + } +#endif free (c); } @@ -250,7 +255,6 @@ pspp_linreg (const gsl_vector * Y, const gsl_matrix * X, { tmp = gsl_matrix_get (sw, i, cache->n_indeps); cache->coeff[i + 1].estimate = tmp; - gsl_vector_set (cache->param_estimates, i + 1, tmp); m -= tmp * gsl_vector_get (cache->indep_means, i); } /* @@ -286,7 +290,6 @@ pspp_linreg (const gsl_vector * Y, const gsl_matrix * X, } gsl_matrix_set (cache->cov, 0, 0, tmp); - gsl_vector_set (cache->param_estimates, 0, m); cache->coeff[0].estimate = m; } else