[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] Changes to pspp/src/factor_stats.c
From: |
John Darrington |
Subject: |
[Pspp-cvs] Changes to pspp/src/factor_stats.c |
Date: |
Sun, 30 Jan 2005 20:54:58 -0500 |
Index: pspp/src/factor_stats.c
diff -u pspp/src/factor_stats.c:1.12 pspp/src/factor_stats.c:1.13
--- pspp/src/factor_stats.c:1.12 Tue Jan 18 11:31:45 2005
+++ pspp/src/factor_stats.c Mon Jan 31 01:54:57 2005
@@ -44,6 +44,7 @@
m->min = DBL_MAX;
m->max = -DBL_MAX;
+ m->histogram = 0;
m->moments = moments1_create(MOMENT_KURTOSIS);
@@ -141,6 +142,13 @@
m->wvp = (struct weighted_value **) hsh_sort(m->ordered_data);
m->n_data = hsh_count(m->ordered_data);
+ /* Trimmed mean calculation */
+ if ( m->n_data <= 1 )
+ {
+ m->trimmed_mean = m->mean;
+ return;
+ }
+
m->histogram = histogram_create(10, m->min, m->max);
for ( i = 0 ; i < m->n_data ; ++i )
@@ -149,13 +157,6 @@
gsl_histogram_accumulate(m->histogram, wv[i]->v.f, wv[i]->w);
}
- /* Trimmed mean calculation */
- if ( m->n_data <= 1 )
- {
- m->trimmed_mean = m->mean;
- return;
- }
-
tc = m->n * 0.05 ;
k1 = -1;
k2 = -1;
@@ -272,7 +273,8 @@
{
hsh_destroy(m->ordered_data);
hsh_destroy(m->ptile_hash);
- gsl_histogram_free(m->histogram);
+ if ( m-> histogram )
+ gsl_histogram_free(m->histogram);
}
void