+ hsh_destroy(m->ordered_data);
+ hsh_destroy(m->ptile_hash);
+ if ( m-> histogram )
+ gsl_histogram_free(m->histogram);
+}
+
+void
+factor_statistics_free(struct factor_statistics *f)
+{
+
+ int i;
+ for ( i = 0 ; i < f->n_var; ++i )
+ metrics_destroy(&f->m[i]);
+ free(f->m) ;
+ free(f);
+}
+
+
+
+
+int
+factor_statistics_compare(const struct factor_statistics *f0,
+ const struct factor_statistics *f1, int width)
+{
+
+ int cmp0;
+
+ assert(f0);
+ assert(f1);
+
+ cmp0 = compare_values(&f0->id[0], &f1->id[0], width);
+
+ if ( cmp0 != 0 )
+ return cmp0;
+
+
+ if ( ( f0->id[1].f == SYSMIS ) && (f1->id[1].f != SYSMIS) )
+ return 1;
+
+ if ( ( f0->id[1].f != SYSMIS ) && (f1->id[1].f == SYSMIS) )
+ return -1;
+
+ return compare_values(&f0->id[1], &f1->id[1], width);
+
+}
+
+unsigned int
+factor_statistics_hash(const struct factor_statistics *f, int width)
+{
+
+ unsigned int h;
+
+ h = hash_value(&f->id[0], width);
+
+ if ( f->id[1].f != SYSMIS )
+ h += hash_value(&f->id[1], width);
+
+
+ return h;
+