X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=heip.cpp;fp=heip.cpp;h=7ae285df5418b4749f611632e3b1bc71f4044f3c;hp=0000000000000000000000000000000000000000;hb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;hpb=1b73ff67c83892a025e597dabd9df6fe7b58206a diff --git a/heip.cpp b/heip.cpp new file mode 100644 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 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); + } +} + +/***********************************************************************/