1 /* PSPP - Creates design matrices.
2 Copyright (C) 2005 Free Software Foundation, Inc.
3 Written by Jason H Stover <jason@sakla.net>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Create design matrices for procedures that need them.
24 #ifndef DESIGN_MATRIX_H
25 #define DESIGN_MATRIX_H
27 #include <gsl/gsl_matrix.h>
29 #include <data/category.h>
30 #include <data/cat-routines.h>
31 struct design_matrix_var
33 size_t first_column; /* First column for this variable in
34 the design_matix. If this variable
35 is categorical, its values are
36 stored in multiple, contiguous
37 columns, as dictated by its vector
38 encoding in the variable's struct
42 const struct variable *v;
47 struct design_matrix_var *vars; /* Element i corresponds to
48 the variable whose values
49 are stored in at least one
51 variable is categorical
53 categories, its values are
55 contiguous columns. The
56 variable's values are then
65 union value *cat_vector_to_value (const gsl_vector *, struct variable *);
67 struct design_matrix *design_matrix_create (int, const struct variable *[],
70 void design_matrix_destroy (struct design_matrix *);
72 void design_matrix_set_categorical (struct design_matrix *, size_t,
73 const struct variable *,
76 void design_matrix_set_numeric (struct design_matrix *, size_t,
77 const struct variable *, const union value *);
79 size_t design_matrix_var_to_column (const struct design_matrix *,
80 const struct variable *);
82 struct variable *design_matrix_col_to_var (const struct design_matrix *,