]> git.donarmstrong.com Git - mothur.git/blobdiff - heip.cpp
Revert to previous commit
[mothur.git] / heip.cpp
diff --git a/heip.cpp b/heip.cpp
new file mode 100644 (file)
index 0000000..7ae285d
--- /dev/null
+++ b/heip.cpp
@@ -0,0 +1,39 @@
+/*
+ *  heip.cpp
+ *  Mothur
+ *
+ *  Created by Pat Schloss on 8/21/10.
+ *  Copyright 2010 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "heip.h"
+#include "shannon.h"
+
+/***********************************************************************/
+
+EstOutput Heip::getValues(SAbundVector* rank){
+       try {
+               data.resize(1,0.0000);
+               vector<double> shanData(3,0);
+               Shannon* shannon = new Shannon();
+               shanData = shannon->getValues(rank);
+               
+               long int sobs = rank->getNumBins();
+               if(sobs > 1){
+                       data[0] = (exp(shanData[0])-1) / (sobs - 1);;
+               }
+               else{
+                       data[0] = 1;
+               }
+               
+               delete shannon;
+               return data;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "Heip", "getValues");
+               exit(1);
+       }
+}
+
+/***********************************************************************/