/[pspp]/pspp/src/factor_stats.c
ViewVC logotype

Diff of /pspp/src/factor_stats.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by jmd, Tue Jan 18 11:31:45 2005 UTC revision 1.13 by jmd, Mon Jan 31 01:54:57 2005 UTC
# Line 44  metrics_precalc(struct metrics *m) Line 44  metrics_precalc(struct metrics *m)
44    m->min = DBL_MAX;    m->min = DBL_MAX;
45    m->max = -DBL_MAX;    m->max = -DBL_MAX;
46    
47      m->histogram = 0;
48    
49    m->moments = moments1_create(MOMENT_KURTOSIS);    m->moments = moments1_create(MOMENT_KURTOSIS);
50    
# Line 141  metrics_postcalc(struct metrics *m) Line 142  metrics_postcalc(struct metrics *m)
142    m->wvp = (struct weighted_value **) hsh_sort(m->ordered_data);    m->wvp = (struct weighted_value **) hsh_sort(m->ordered_data);
143    m->n_data = hsh_count(m->ordered_data);    m->n_data = hsh_count(m->ordered_data);
144    
145      /* Trimmed mean calculation */
146      if ( m->n_data <= 1 )
147        {
148          m->trimmed_mean = m->mean;
149          return;
150        }
151    
152    m->histogram = histogram_create(10, m->min, m->max);    m->histogram = histogram_create(10, m->min, m->max);
153    
154    for ( i = 0 ; i < m->n_data ; ++i )    for ( i = 0 ; i < m->n_data ; ++i )
# Line 149  metrics_postcalc(struct metrics *m) Line 157  metrics_postcalc(struct metrics *m)
157        gsl_histogram_accumulate(m->histogram, wv[i]->v.f, wv[i]->w);        gsl_histogram_accumulate(m->histogram, wv[i]->v.f, wv[i]->w);
158      }      }
159    
   /* Trimmed mean calculation */  
   if ( m->n_data <= 1 )  
     {  
       m->trimmed_mean = m->mean;  
       return;  
     }  
   
160    tc = m->n * 0.05 ;    tc = m->n * 0.05 ;
161    k1 = -1;    k1 = -1;
162    k2 = -1;    k2 = -1;
# Line 272  metrics_destroy(struct metrics *m) Line 273  metrics_destroy(struct metrics *m)
273  {  {
274    hsh_destroy(m->ordered_data);    hsh_destroy(m->ordered_data);
275    hsh_destroy(m->ptile_hash);    hsh_destroy(m->ptile_hash);
276    gsl_histogram_free(m->histogram);    if ( m-> histogram )
277        gsl_histogram_free(m->histogram);
278  }  }
279    
280  void  void

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26