projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
now builds frequency tables
[pspp]
/
src
/
math
/
categoricals.c
diff --git
a/src/math/categoricals.c
b/src/math/categoricals.c
index 30c4c567ce607bc1baaeaceeab599c86ba2fd1f5..83326c3f006789814c4930feed8d85d15db95155 100644
(file)
--- a/
src/math/categoricals.c
+++ b/
src/math/categoricals.c
@@
-276,6
+276,7
@@
categoricals_destroy (struct categoricals *cat)
free (cat->iap[i].enc_sum);
hmap_destroy (&cat->iap[i].ivmap);
}
free (cat->iap[i].enc_sum);
hmap_destroy (&cat->iap[i].ivmap);
}
+ free (cat->iap);
/* Interate over each variable and delete its value map.
/* Interate over each variable and delete its value map.
@@
-322,7
+323,7
@@
struct categoricals *
categoricals_create (struct interaction *const *inter, size_t n_inter,
const struct variable *wv, enum mv_class fctr_excl)
{
categoricals_create (struct interaction *const *inter, size_t n_inter,
const struct variable *wv, enum mv_class fctr_excl)
{
- struct categoricals *cat =
xzalloc (sizeof *cat
);
+ struct categoricals *cat =
XZALLOC (struct categoricals
);
cat->iap = pool_calloc (cat->pool, n_inter, sizeof *cat->iap);
cat->n_iap = n_inter;
cat->wv = wv;
cat->iap = pool_calloc (cat->pool, n_inter, sizeof *cat->iap);
cat->n_iap = n_inter;
cat->wv = wv;
@@
-366,7
+367,7
@@
categoricals_update (struct categoricals *cat, const struct ccase *c)
assert (!cat->cat_to_iact);
double weight;
assert (!cat->cat_to_iact);
double weight;
- weight = cat->wv ? case_
data (c, cat->wv)->f
: 1.0;
+ weight = cat->wv ? case_
num (c, cat->wv)
: 1.0;
weight = var_force_valid_weight (cat->wv, weight, NULL);
/* Update the frequency table for each variable. */
weight = var_force_valid_weight (cat->wv, weight, NULL);
/* Update the frequency table for each variable. */
@@
-382,7
+383,7
@@
categoricals_update (struct categoricals *cat, const struct ccase *c)
{
valn = pool_malloc (cat->pool, sizeof *valn);
valn->index = -1;
{
valn = pool_malloc (cat->pool, sizeof *valn);
valn->index = -1;
- value_init
(
&valn->val, width);
+ value_init
_pool (cat->pool,
&valn->val, width);
value_copy (&valn->val, val, width);
hmap_insert (&vn->valmap, &valn->node, hash);
}
value_copy (&valn->val, val, width);
hmap_insert (&vn->valmap, &valn->node, hash);
}
@@
-479,7
+480,7
@@
categoricals_done (const struct categoricals *cat_)
return;
}
return;
}
- struct value_node **nodes =
xcalloc (sizeof *nodes, n_vals
);
+ struct value_node **nodes =
XCALLOC (n_vals, struct value_node *
);
int x = 0;
struct value_node *valnd;
HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap)
int x = 0;
struct value_node *valnd;
HMAP_FOR_EACH (valnd, struct value_node, node, &vn->valmap)