X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Flinreg.c;h=d417599babd94f9fa9afc9030b457ca8e03bfcb4;hb=5d1c47b1ef2d392ce223606139d45eac749d4c80;hp=600262f6fbbddabdec66c0561ce94bd29eaa76fd;hpb=6abd8f3ba67ec3751fc47487c1e09cf8e8de144a;p=pspp diff --git a/src/math/linreg.c b/src/math/linreg.c index 600262f6fb..d417599bab 100644 --- a/src/math/linreg.c +++ b/src/math/linreg.c @@ -275,11 +275,11 @@ linreg_predict (const struct linreg *c, const double *vals, size_t n_vals) size_t j; double result; - assert (n_vals == c->n_coeffs); if (vals == NULL || c == NULL) { return GSL_NAN; } + assert (n_vals == c->n_coeffs); if (c->coeff == NULL) { /* The stupid model: just guess the mean. */ @@ -322,6 +322,7 @@ linreg_set_indep_variable_mean (struct linreg *c, size_t j, double m) gsl_vector_set (c->indep_means, j, m); } +#if 0 static void linreg_fit_qr (const gsl_matrix *cov, struct linreg *l) { @@ -415,6 +416,7 @@ linreg_fit_qr (const gsl_matrix *cov, struct linreg *l) gsl_matrix_free (xtx); gsl_vector_free (params); } +#endif #define REG_LARGE_DATA 1000 @@ -432,6 +434,9 @@ linreg_fit (const gsl_matrix *cov, struct linreg *l) l->sst = gsl_matrix_get (cov, cov->size1 - 1, cov->size2 - 1); +#if 0 + /* This QR decomposition path seems to produce the incorrect + values. See https://savannah.gnu.org/bugs/?51373 */ if ((l->n_obs * l->n_obs > l->n_indeps) && (l->n_obs > REG_LARGE_DATA)) { /* @@ -440,6 +445,7 @@ linreg_fit (const gsl_matrix *cov, struct linreg *l) linreg_fit_qr (cov, l); } else +#endif { gsl_matrix *params = gsl_matrix_calloc (cov->size1, cov->size2); gsl_matrix_memcpy (params, cov); @@ -524,19 +530,19 @@ double linreg_sst (const struct linreg *c) } double -linreg_dfmodel ( const struct linreg *c) +linreg_dfmodel (const struct linreg *c) { return c->dfm; } double -linreg_dferror ( const struct linreg *c) +linreg_dferror (const struct linreg *c) { return c->dfe; } double -linreg_dftotal ( const struct linreg *c) +linreg_dftotal (const struct linreg *c) { return c->dft; }