Create design matrices for procedures that need them.
*/
#include <config.h>
+
+#include "design-matrix.h"
+
+#include <assert.h>
+#include <math.h>
#include <stdlib.h>
+#include <string.h>
+
#include <libpspp/alloc.h>
#include <libpspp/message.h>
#include <data/variable.h>
#include <data/category.h>
-#include "design-matrix.h"
-#include <string.h>
-#include <math.h>
+
#include <gsl/gsl_machine.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
(dm->vars + i)->v = v; /* Allows us to look up the variable from
the design matrix. */
(dm->vars + i)->first_column = n_cols;
- if (v->type == NUMERIC)
+ if (var_is_numeric (v))
{
(dm->vars + i)->last_column = n_cols;
n_cols++;
}
- else if (v->type == ALPHA)
+ else if (var_is_alpha (v))
{
assert (v->obs_vals != NULL);
(dm->vars + i)->last_column =
size_t lc;
double entry;
- assert (var->type == ALPHA);
+ assert (var_is_alpha (var));
fc = design_matrix_var_to_column (dm, var);
lc = dm_var_to_last_column (dm, var);
assert (lc != DM_COLUMN_NOT_FOUND);
{
size_t col;
- assert (var->type == NUMERIC);
+ assert (var_is_numeric (var));
col = design_matrix_var_to_column ((const struct design_matrix *) dm, var);
assert (col != DM_COLUMN_NOT_FOUND);
gsl_matrix_set (dm->m, row, col, val->f);