Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
*/
+#include <config.h>
#include <gsl/gsl_fit.h>
#include <gsl/gsl_multifit.h>
*/
#include <math/linreg/linreg.h>
-#include <math/linreg/coefficient.h>
+#include <math/coefficient.h>
#include <gsl/gsl_errno.h>
#include <linreg/sweep.h>
/*
pspp_linreg_get_vars (const void *c_, struct variable **v)
{
const pspp_linreg_cache *c = c_;
- struct pspp_linreg_coeff *coef = NULL;
+ struct pspp_coeff *coef = NULL;
const struct variable *tmp;
int i;
int result = 0;
/*
Start at c->coeff[1] to avoid the intercept.
*/
- v[result] = (struct variable *) pspp_linreg_coeff_get_var (c->coeff[1], 0);
+ v[result] = (struct variable *) pspp_coeff_get_var (c->coeff[1], 0);
result = (v[result] == NULL) ? 0 : 1;
for (coef = c->coeff[2]; coef < c->coeff[c->n_coeffs]; coef++)
{
- tmp = pspp_linreg_coeff_get_var (coef, 0);
+ tmp = pspp_coeff_get_var (coef, 0);
assert (tmp != NULL);
/* Repeated variables are likely to bunch together, at the end
of the array. */
i = result - 1;
- while (i >= 0 && (v[i]->index != tmp->index))
+ while (i >= 0 && v[i] != tmp)
{
i--;
}
int i;
pspp_linreg_cache *c = m;
- gsl_vector_free (c->indep_means);
- gsl_vector_free (c->indep_std);
- gsl_vector_free (c->ss_indeps);
- gsl_matrix_free (c->cov);
- for (i = 0; i < c->n_coeffs; i++)
+ if (c != NULL)
{
- pspp_linreg_coeff_free (c->coeff[i]);
+ gsl_vector_free (c->indep_means);
+ gsl_vector_free (c->indep_std);
+ gsl_vector_free (c->ss_indeps);
+ gsl_matrix_free (c->cov);
+ for (i = 0; i < c->n_coeffs; i++)
+ {
+ pspp_coeff_free (c->coeff[i]);
+ }
+ free (c);
}
- free (c);
return true;
}