]> git.donarmstrong.com Git - mothur.git/blob - shannonrange.cpp
fixes while testing 1.33.0
[mothur.git] / shannonrange.cpp
1 //
2 //  shannonrange.cpp
3 //  Mothur
4 //
5 //  Created by SarahsWork on 1/3/14.
6 //  Copyright (c) 2014 Schloss Lab. All rights reserved.
7 //
8
9 #include "shannonrange.h"
10
11 /***********************************************************************/
12
13 EstOutput RangeShannon::getValues(vector<SharedRAbundVector*> shared) {
14         try {
15         data.resize(3,0);
16         
17         double commSize = 1e20;
18         
19         SAbundVector sabund1 = shared[0]->getSAbundVector();
20         SAbundVector sabund2 = shared[1]->getSAbundVector();
21         
22         double sampleSize = 0;
23         for (int i = 0; i < sabund1.getNumBins(); i++) {  sampleSize += (sabund1.get(i) * sabund2.get(i));  }
24         int aux = ceil(pow((sampleSize+1), 0.33333));
25                 
26                 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
27                 
28                 return data;
29         }
30         catch(exception& e) {
31                 m->errorOut(e, "RangeShannon", "getValues");
32                 exit(1);
33         }
34 }
35 /***********************************************************************/