1 /* PSPP - Creates design matrices.
2 Copyright (C) 2005 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 Create design matrices for procedures that need them.
23 #ifndef DESIGN_MATRIX_H
24 #define DESIGN_MATRIX_H
26 #include <gsl/gsl_matrix.h>
28 #include <data/category.h>
30 struct design_matrix_var
32 size_t first_column; /* First column for this variable in
33 the design_matix. If this variable
34 is categorical, its values are
35 stored in multiple, contiguous
36 columns, as dictated by its vector
37 encoding in the variable's struct
41 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
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 *,
80 size_t design_matrix_var_to_column (const struct design_matrix *,
81 const struct variable *);
83 const struct variable *design_matrix_col_to_var (const struct design_matrix *,