X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=shannonrange.cpp;fp=shannonrange.cpp;h=f26f08a1f541177ae607d60be6aec0964fb19241;hb=a2cde58c1e72199498a2142983ef040dce36da10;hp=0000000000000000000000000000000000000000;hpb=3e8b80da722e11c72bce957e2f42a6e884dd02b6;p=mothur.git diff --git a/shannonrange.cpp b/shannonrange.cpp new file mode 100644 index 0000000..f26f08a --- /dev/null +++ b/shannonrange.cpp @@ -0,0 +1,35 @@ +// +// shannonrange.cpp +// Mothur +// +// Created by SarahsWork on 1/3/14. +// Copyright (c) 2014 Schloss Lab. All rights reserved. +// + +#include "shannonrange.h" + +/***********************************************************************/ + +EstOutput RangeShannon::getValues(vector shared) { + try { + data.resize(3,0); + + double commSize = 1e20; + + SAbundVector sabund1 = shared[0]->getSAbundVector(); + SAbundVector sabund2 = shared[1]->getSAbundVector(); + + double sampleSize = 0; + for (int i = 0; i < sabund1.getNumBins(); i++) { sampleSize += (sabund1.get(i) * sabund2.get(i)); } + int aux = ceil(pow((sampleSize+1), 0.33333)); + + if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } + + return data; + } + catch(exception& e) { + m->errorOut(e, "RangeShannon", "getValues"); + exit(1); + } +} +/***********************************************************************/