X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=completelinkage.cpp;fp=completelinkage.cpp;h=69b68a061fb0d8ccb7cf58ec8ca27af1e3f11f27;hb=20a2d0350a737a434c89f303662d64a8eeea7b05;hp=0000000000000000000000000000000000000000;hpb=bbb5879a7e566935c23d63d42bb945072424b939;p=mothur.git diff --git a/completelinkage.cpp b/completelinkage.cpp new file mode 100644 index 0000000..69b68a0 --- /dev/null +++ b/completelinkage.cpp @@ -0,0 +1,71 @@ + +#include "cluster.hpp" +#include + +/***********************************************************************/ + +CompleteLinkage::CompleteLinkage(RAbundVector* rav, ListVector* lv, SparseMatrix* dm) : +Cluster(rav, lv, dm) +{} + +/***********************************************************************/ +//This function clusters based on the furthest neighbor method. +void CompleteLinkage::update(){ + 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]); + + } + clusterBins(); + clusterNames(); + + for(int i=0;irmCell(colCells[i]); + } + } + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the CompleteLinkage class Function update. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the CompleteLinkage class function update. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + +} + +/***********************************************************************/