47 |
struct recoded_categorical |
struct recoded_categorical |
48 |
{ |
{ |
49 |
const struct variable *v; /* Original variable. */ |
const struct variable *v; /* Original variable. */ |
50 |
union value **vals; |
union value *vals; |
51 |
gsl_matrix *m; /* Vector-encoded values of the original |
gsl_matrix *m; /* Vector-encoded values of the |
52 |
variable. The ith row of the matrix corresponds |
original variable. The ith row of |
53 |
to the ith value of a categorical variable. |
the matrix corresponds to the ith |
54 |
|
value of a categorical variable. |
55 |
*/ |
*/ |
56 |
size_t n_categories; |
size_t n_categories; |
57 |
size_t first_column; /* First column of the gsl_matrix which |
size_t first_column; /* First column of the gsl_matrix which |
59 |
variable. |
variable. |
60 |
*/ |
*/ |
61 |
size_t last_column; /* Last column containing the recoded |
size_t last_column; /* Last column containing the recoded |
62 |
categories. The practice of keeping only the |
categories. The practice of |
63 |
first and last columns of the matrix implies |
keeping only the first and last |
64 |
those columns corresponding to v must be |
columns of the matrix implies those |
65 |
|
columns corresponding to v must be |
66 |
contiguous. |
contiguous. |
67 |
*/ |
*/ |
68 |
size_t n_allocated_categories; /* This is used only during initialization |
size_t n_allocated_categories; /* This is used only during |
69 |
to keep track of the number of values |
initialization to keep |
70 |
stored. |
track of the number of |
71 |
*/ |
values stored. |
72 |
|
*/ |
73 |
}; |
}; |
74 |
|
|
75 |
/* |
/* |
99 |
in the variable's struct recoded_categorical. |
in the variable's struct recoded_categorical. |
100 |
*/ |
*/ |
101 |
int last_column; |
int last_column; |
102 |
struct variable *v; |
const struct variable *v; |
103 |
}; |
}; |
104 |
struct design_matrix |
struct design_matrix |
105 |
{ |
{ |
118 |
*/ |
*/ |
119 |
size_t n_vars; |
size_t n_vars; |
120 |
}; |
}; |
121 |
const union value *cr_vector_to_value (const gsl_vector *, |
union value *cr_vector_to_value (const gsl_vector *, |
122 |
struct recoded_categorical *); |
struct recoded_categorical *); |
123 |
|
|
124 |
void cr_value_update (struct recoded_categorical *, const union value *); |
void cr_value_update (struct recoded_categorical *, const union value *); |
125 |
|
|
158 |
size_t design_matrix_var_to_column (const struct design_matrix *, |
size_t design_matrix_var_to_column (const struct design_matrix *, |
159 |
const struct variable *); |
const struct variable *); |
160 |
|
|
161 |
const struct variable *design_matrix_col_to_var (const struct design_matrix *, |
struct variable *design_matrix_col_to_var (const struct design_matrix *, |
162 |
size_t); |
size_t); |
163 |
|
|
164 |
void |
void |
165 |
design_matrix_set (struct design_matrix *, size_t, |
design_matrix_set (struct design_matrix *, size_t, |