Changeset 5c46b9c


Ignore:
Timestamp:
11/20/18 16:54:16 (2 years ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
5dba5e7
Parents:
a7132cf
Message:

Posible fix calculating mean in circumstances when the entire octets count is from a single number

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/stats/ipdist-parallel.c

    ra7132cf r5c46b9c  
    145145                        }
    146146                }
    147 
    148                 tally->stats->mean_src[k] = (k + (ex / n));
     147                // tally->stats->mean_src[k] = (k + (ex / n));
     148                tally->stats->mean_src[k] = (m + (ex / n));
    149149                tally->stats->variance_src[k] = ((ex2 - (ex*ex)/n) / n);
    150150                tally->stats->stddev_src[k] = sqrt(tally->stats->variance_src[k]);
     
    164164                        }
    165165                }
    166                 tally->stats->mean_dst[k] = (k + (ex / n));
     166                // tally->stats->mean_dst[k] = (k + (ex / n));
     167                tally->stats->mean_dst[k] = (m + (ex / n));
    167168                tally->stats->variance_dst[k] = ((ex2 - (ex*ex)/n) / n);
    168169                tally->stats->stddev_dst[k] = sqrt(tally->stats->variance_dst[k]);
     170
    169171                /* Get the median */
    170172                int c = (n/2) - tally->src[k][0];
     
    182184                }
    183185                tally->stats->median_dst[k] = c2;
     186
    184187                /* Get the mode which is the first item in the priority queue */
    185188                tally->stats->mode_src[k] = peak(&tally->stats->rank_src[k]);
    186189                tally->stats->mode_dst[k] = peak(&tally->stats->rank_src[k]);
     190
    187191                /* Calculate skewness */
    188192                tally->stats->skewness_src[k] = (tally->stats->mean_src[k] - tally->stats->median_src[k]) / tally->stats->stddev_src[k];
Note: See TracChangeset for help on using the changeset viewer.