]> git.donarmstrong.com Git - mothur.git/blob - solow.cpp
fixed some bugs
[mothur.git] / solow.cpp
1 /*
2  *  solow.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 5/13/09.
6  *  Copyright 2009Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "solow.h"
11 #include <math.h>
12
13         
14 /***********************************************************************/       
15 EstOutput Solow::getValues(SAbundVector* rank){
16
17         try {
18                 data.resize(1,0);
19                 
20                 double n = (double)rank->getNumSeqs();
21                 double f1 = (double)rank->get(1);
22                 double f2 = (double)rank->get(2);
23
24                 data[0] = f1*f1/2/f2 * (1 - pow(1 - 2*f2/n/f1, m));
25                 
26                 return data;
27         }
28         catch(exception& e) {
29                 cout << "Standard Error: " << e.what() << " has occurred in the Coverage class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
30                 exit(1);
31         }
32         catch(...) {
33                 cout << "An unknown error has occurred in the Coverage class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
34                 exit(1);
35         }       
36 }
37
38
39 /***********************************************************************/