projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Parameter estimate matched with appropriate variable in linreg cache
[pspp]
/
src
/
cat.c
diff --git
a/src/cat.c
b/src/cat.c
index afdb44ef7253216dee4c67017af8d763ed7ad0a5..0dd9a014ad5cde729d7629ff1b975a9c6324fa21 100644
(file)
--- a/
src/cat.c
+++ b/
src/cat.c
@@
-65,7
+65,7
@@
cr_recoded_categorical_create (const struct variable *v)
rc->v = v;
rc->n_categories = 0;
rc->n_allocated_categories = N_INITIAL_CATEGORIES;
rc->v = v;
rc->n_categories = 0;
rc->n_allocated_categories = N_INITIAL_CATEGORIES;
- rc->vals = x
malloc (N_INITIAL_CATEGORIES * sizeof (*rc->vals)
);
+ rc->vals = x
nmalloc (N_INITIAL_CATEGORIES, sizeof *rc->vals
);
return rc;
}
return rc;
}
@@
-85,7
+85,7
@@
cr_recoded_cat_ar_create (int n_variables, struct variable *v_variables[])
struct recoded_categorical_array *ca;
struct variable *v;
struct recoded_categorical_array *ca;
struct variable *v;
- ca =
(struct recoded_categorical_array *) xmalloc (sizeof (*ca)
);
+ ca =
xmalloc (sizeof *ca
);
for (i = 0; i < n_variables; i++)
{
v = v_variables[i];
for (i = 0; i < n_variables; i++)
{
v = v_variables[i];
@@
-95,7
+95,7
@@
cr_recoded_cat_ar_create (int n_variables, struct variable *v_variables[])
}
}
ca->n_vars = n_categoricals;
}
}
ca->n_vars = n_categoricals;
- ca->a = x
malloc (n_categoricals * sizeof (*(ca->a))
);
+ ca->a = x
nmalloc (n_categoricals, sizeof *ca->a
);
for (i = 0; i < n_categoricals; i++)
{
*(ca->a + i) = cr_recoded_categorical_create (v_variables[i]);
for (i = 0; i < n_categoricals; i++)
{
*(ca->a + i) = cr_recoded_categorical_create (v_variables[i]);
@@
-145,8
+145,8
@@
cr_value_update (struct recoded_categorical *rc, const union value *v)
if (rc->n_categories >= rc->n_allocated_categories)
{
rc->n_allocated_categories *= 2;
if (rc->n_categories >= rc->n_allocated_categories)
{
rc->n_allocated_categories *= 2;
- rc->vals = x
realloc (rc->vals, rc->n_allocated_categories
-
* sizeof (*(rc->vals))
);
+ rc->vals = x
nrealloc (rc->vals,
+
rc->n_allocated_categories, sizeof *rc->vals
);
}
rc->vals[rc->n_categories] = *v;
rc->n_categories++;
}
rc->vals[rc->n_categories] = *v;
rc->n_categories++;
@@
-319,8
+319,8
@@
design_matrix_create (int n_variables,
size_t n_cols = 0;
size_t col;
size_t n_cols = 0;
size_t col;
- dm = xmalloc (sizeof
(*dm)
);
- dm->vars = x
malloc (n_variables * sizeof (struct variable *)
);
+ dm = xmalloc (sizeof
*dm
);
+ dm->vars = x
nmalloc (n_variables, sizeof *dm->vars
);
dm->n_vars = n_variables;
for (i = 0; i < n_variables; i++)
dm->n_vars = n_variables;
for (i = 0; i < n_variables; i++)
@@
-341,7
+341,7
@@
design_matrix_create (int n_variables,
}
}
dm->m = gsl_matrix_calloc (n_data, n_cols);
}
}
dm->m = gsl_matrix_calloc (n_data, n_cols);
- dm->vars = x
malloc (dm->n_vars * sizeof (*(dm->vars))
);
+ dm->vars = x
nmalloc (dm->n_vars, sizeof *dm->vars
);
assert (dm->vars != NULL);
col = 0;
assert (dm->vars != NULL);
col = 0;
@@
-354,6
+354,7
@@
design_matrix_create (int n_variables,
tmp = &(dm->vars[col]);
tmp->v = v;
tmp->first_column = col;
tmp = &(dm->vars[col]);
tmp->v = v;
tmp->first_column = col;
+ tmp->last_column = col;
col++;
}
else if (v->type == ALPHA)
col++;
}
else if (v->type == ALPHA)
@@
-399,7
+400,7
@@
design_matrix_col_to_var_index (const struct design_matrix *dm, size_t col)
/*
Return a pointer to the variable whose values
/*
Return a pointer to the variable whose values
- are stored in column col.
+ are stored in column col.
BUG IN HERE
*/
struct variable *
design_matrix_col_to_var (const struct design_matrix *dm, size_t col)
*/
struct variable *
design_matrix_col_to_var (const struct design_matrix *dm, size_t col)