5 * Created by westcott on 12/15/10.
6 * Copyright 2010 Schloss Lab. All rights reserved.
10 #include "hellinger.h"
12 /***********************************************************************/
13 EstOutput Hellinger::getValues(vector<SharedRAbundVector*> shared) {
20 //calc the 2 denominators
21 for (int i = 0; i < shared[0]->getNumBins(); i++) {
22 sumA += shared[0]->getAbundance(i);
23 sumB += shared[1]->getAbundance(i);
29 for (int i = 0; i < shared[0]->getNumBins(); i++) {
31 int Aij = shared[0]->getAbundance(i);
32 int Bij = shared[1]->getAbundance(i);
34 double term1 = sqrt((Aij / sumA));
35 double term2 = sqrt((Bij / sumB));
37 sum += ((term1 - term2) * (term1 - term2));
42 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
47 m->errorOut(e, "Hellinger", "getValues");
51 /***********************************************************************/