projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6872e65
)
ctables: Minor refactoring.
author
Ben Pfaff
<blp@cs.stanford.edu>
Mon, 31 Jan 2022 06:10:12 +0000
(22:10 -0800)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 2 Apr 2022 01:48:55 +0000
(18:48 -0700)
src/language/stats/ctables.c
patch
|
blob
|
history
diff --git
a/src/language/stats/ctables.c
b/src/language/stats/ctables.c
index 4a0787dd21e9f30d48f89dc12d1acc5af41face5..d6b5a0ca0c119c9764e49377d65a286466f5dcf8 100644
(file)
--- a/
src/language/stats/ctables.c
+++ b/
src/language/stats/ctables.c
@@
-2649,15
+2649,9
@@
recurse_subtotals (struct ctables_table *t, const struct ccase *c,
static void
ctables_cell_insert (struct ctables_table *t,
const struct ccase *c,
static void
ctables_cell_insert (struct ctables_table *t,
const struct ccase *c,
- size_t i
r, size_t ic, size_t il
,
+ size_t i
x[PIVOT_N_AXES]
,
double d_weight, double e_weight)
{
double d_weight, double e_weight)
{
- size_t ix[PIVOT_N_AXES] = {
- [PIVOT_AXIS_ROW] = ir,
- [PIVOT_AXIS_COLUMN] = ic,
- [PIVOT_AXIS_LAYER] = il,
- };
-
const struct ctables_category *cats[PIVOT_N_AXES][10];
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
{
const struct ctables_category *cats[PIVOT_N_AXES][10];
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
{
@@
-2924,6
+2918,8
@@
ctables_table_output (struct ctables *ct, struct ctables_table *t)
struct pivot_category *parent = k ? groups[k - 1] : d[a]->root;
if (level->type == CTL_SUMMARY)
{
struct pivot_category *parent = k ? groups[k - 1] : d[a]->root;
if (level->type == CTL_SUMMARY)
{
+ assert (k == n_levels - 1);
+
const struct ctables_summary_spec_set *specs = &t->summary_specs;
for (size_t m = 0; m < specs->n; m++)
{
const struct ctables_summary_spec_set *specs = &t->summary_specs;
for (size_t m = 0; m < specs->n; m++)
{
@@
-3339,7
+3335,15
@@
ctables_execute (struct dataset *ds, struct ctables *ct)
for (size_t ir = 0; ir < t->stacks[PIVOT_AXIS_ROW].n; ir++)
for (size_t ic = 0; ic < t->stacks[PIVOT_AXIS_COLUMN].n; ic++)
for (size_t il = 0; il < t->stacks[PIVOT_AXIS_LAYER].n; il++)
for (size_t ir = 0; ir < t->stacks[PIVOT_AXIS_ROW].n; ir++)
for (size_t ic = 0; ic < t->stacks[PIVOT_AXIS_COLUMN].n; ic++)
for (size_t il = 0; il < t->stacks[PIVOT_AXIS_LAYER].n; il++)
- ctables_cell_insert (t, c, ir, ic, il, d_weight, e_weight);
+ {
+ size_t ix[PIVOT_N_AXES] = {
+ [PIVOT_AXIS_ROW] = ir,
+ [PIVOT_AXIS_COLUMN] = ic,
+ [PIVOT_AXIS_LAYER] = il,
+ };
+
+ ctables_cell_insert (t, c, ix, d_weight, e_weight);
+ }
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
if (t->label_axis[a] != a)
for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++)
if (t->label_axis[a] != a)