pspp-cvs
[Top][All Lists]
Advanced

[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: Tue, 18 Jan 2005 06:31:47 -0500

Index: pspp/src/factor_stats.c
diff -u pspp/src/factor_stats.c:1.11 pspp/src/factor_stats.c:1.12
--- pspp/src/factor_stats.c:1.11        Fri Dec 31 08:51:07 2004
+++ pspp/src/factor_stats.c     Tue Jan 18 11:31:45 2005
@@ -124,7 +124,6 @@
   int i;
   int j = 1;  
 
-
   moments1_calculate (m->moments, &m->n, &m->mean, &m->var, 
                      &m->skewness, &m->kurtosis);
 
@@ -207,6 +206,7 @@
   m->trimmed_mean += (m->wvp[k1 + 1]->cc - tc) * m->wvp[k1 + 1]->v.f ;
   m->trimmed_mean /= 0.9 * m->n ;
 
+
 }
 
 
@@ -225,7 +225,12 @@
 void 
 weighted_value_free(struct weighted_value *wv)
 {
-  struct case_node *cn = wv->case_nos;
+  struct case_node *cn ;
+
+  if ( !wv ) 
+    return ;
+
+  cn = wv->case_nos;
 
   while(cn)
     {
@@ -255,16 +260,28 @@
   f->id[0] = *id0;
   f->id[1] = *id1;
   f->m = xmalloc( sizeof ( struct metrics ) * n ) ;
+  memset (f->m, 0, sizeof(struct metrics) * n);
+  f->n_var = n;
 
   return f;
 }
 
 
+void 
+metrics_destroy(struct metrics *m)
+{
+  hsh_destroy(m->ordered_data);
+  hsh_destroy(m->ptile_hash);
+  gsl_histogram_free(m->histogram);
+}
+
 void
 factor_statistics_free(struct factor_statistics *f)
 {
-  hsh_destroy(f->m->ordered_data);
-  gsl_histogram_free(f->m->histogram);
+
+  int i; 
+  for ( i = 0 ; i < f->n_var; ++i ) 
+       metrics_destroy(&f->m[i]);
   free(f->m) ; 
   free(f);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]