This seems generally a bit cleaner to me.
destroy (struct statistic *stat)
{
struct percentile *ptl = UP_CAST (stat, struct percentile, parent.parent);
destroy (struct statistic *stat)
{
struct percentile *ptl = UP_CAST (stat, struct percentile, parent.parent);
- struct order_stats *os = &ptl->parent;
- free (os->k);
- os->k = xcalloc (2, sizeof (*os->k));
os->k[0].tc = W * p;
os->k[1].tc = (W + 1.0) * p;
os->k[0].tc = W * p;
os->k[1].tc = (W + 1.0) * p;
double g2;
double g2_star;
double g2;
double g2_star;
};
/* Create the Pth percentile.
};
/* Create the Pth percentile.
destroy (struct statistic *s)
{
struct trimmed_mean *tm = UP_CAST (s, struct trimmed_mean, parent.parent);
destroy (struct statistic *s)
{
struct trimmed_mean *tm = UP_CAST (s, struct trimmed_mean, parent.parent);
- struct order_stats *os = &tm->parent;
- free (os->k);
struct statistic *stat = &os->parent;
os->n_k = 2;
struct statistic *stat = &os->parent;
os->n_k = 2;
- os->k = xcalloc (2, sizeof (*os->k));
assert (tail >= 0);
assert (tail <= 1);
assert (tail >= 0);
assert (tail <= 1);
};
struct trimmed_mean * trimmed_mean_create (double W, double c_min);
};
struct trimmed_mean * trimmed_mean_create (double W, double c_min);
destroy (struct statistic *s)
{
struct tukey_hinges *th = UP_CAST (s, struct tukey_hinges, parent.parent);
destroy (struct statistic *s)
{
struct tukey_hinges *th = UP_CAST (s, struct tukey_hinges, parent.parent);
- struct order_stats *os = &th->parent;
-
- free (os->k);
- free (s);
assert (c_min >= 0);
os->n_k = 3;
assert (c_min >= 0);
os->n_k = 3;
- os->k = xcalloc (3, sizeof (*os->k));
struct tukey_hinges
{
struct order_stats parent;
struct tukey_hinges
{
struct order_stats parent;
};
struct tukey_hinges * tukey_hinges_create (double W, double c_min);
};
struct tukey_hinges * tukey_hinges_create (double W, double c_min);