if (!ps)
return;
- size_t n_new = 0;
+ size_t n_changed = 0;
for (size_t i = 0; i < ps->n; i++)
{
struct pivot_splits_var *psvar = &ps->vars[i];
psval->leaf = pivot_category_create_leaf (
psvar->dimension->root,
pivot_value_new_var_value (psvar->var, value));
- n_new++;
}
- ps->dindexes[i] = psval->leaf;
+ if (ps->dindexes[i] != psval->leaf)
+ {
+ ps->dindexes[i] = psval->leaf;
+ n_changed++;
+ }
}
- if (!n_new)
+ if (!n_changed)
{
if (ps->warnings_left-- > 0)
{
assert (ps->dindexes[0] != SIZE_MAX);
for (size_t i = 0; i < ps->n; i++)
- dindexes[i] = ps->dindexes[i];
+ dindexes[ps->n - i - 1] = ps->dindexes[i];
return ps->n;
}