X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=completelinkage.cpp;h=09ba9639fdbf4146fc955a1c2ac23e696bb62cd6;hb=1b9d0a66e4737f31d16824fe93944880b9edc530;hp=f69753b34a3ecdfb74fbd9e5fe068954c1cd493f;hpb=9a339a6b007b23c39b7eb20cc777af66dd2cebef;p=mothur.git diff --git a/completelinkage.cpp b/completelinkage.cpp index f69753b..09ba963 100644 --- a/completelinkage.cpp +++ b/completelinkage.cpp @@ -1,64 +1,32 @@ #include "cluster.hpp" -#include "mothur.h" /***********************************************************************/ CompleteLinkage::CompleteLinkage(RAbundVector* rav, ListVector* lv, SparseMatrix* dm) : -Cluster(rav, lv, dm) + Cluster(rav, lv, dm) {} /***********************************************************************/ -//This function clusters based on the furthest neighbor method. -void CompleteLinkage::update(){ +//This function returns the tag of the method. +string CompleteLinkage::getTag() { + return("fn"); +} + + +/***********************************************************************/ +//This function updates the distance based on the furthest neighbor method. +bool CompleteLinkage::updateDistance(MatData& colCell, MatData& rowCell) { try { - getRowColCells(); - - vector found(nColCells, 0); - - for(int i=1;irow == smallRow){ - search = rowCells[i]->column; - } - else{ - search = rowCells[i]->row; - } - - for(int j=1;jrow == search || colCells[j]->column == search){ - - if(colCells[j]->dist < rowCells[i]->dist){ - colCells[j]->dist = rowCells[i]->dist; - - if(colCells[j]->vectorMap != NULL){ - *(colCells[j]->vectorMap) = NULL; - colCells[j]->vectorMap = NULL; - } - - } - - found[j] = 1; - break; - } - } - dMatrix->rmCell(rowCells[i]); - + bool changed = false; + if (colCell->dist < rowCell->dist) { + colCell->dist = rowCell->dist; + changed = true; } - clusterBins(); - clusterNames(); - - for(int i=0;irmCell(colCells[i]); - } - } + return(changed); } catch(exception& e) { - errorOut(e, "CompleteLinkage", "update"); + errorOut(e, "CompleteLinkage", "updateDistance"); exit(1); } }