X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=completelinkage.cpp;h=06ed2db6495a0897c74c2b278aac642a15ea1c78;hp=69b68a061fb0d8ccb7cf58ec8ca27af1e3f11f27;hb=a8e2df1b96a57f5f29576b08361b86a96a8eff4f;hpb=20a2d0350a737a434c89f303662d64a8eeea7b05 diff --git a/completelinkage.cpp b/completelinkage.cpp index 69b68a0..06ed2db 100644 --- a/completelinkage.cpp +++ b/completelinkage.cpp @@ -1,71 +1,34 @@ #include "cluster.hpp" -#include /***********************************************************************/ -CompleteLinkage::CompleteLinkage(RAbundVector* rav, ListVector* lv, SparseMatrix* dm) : -Cluster(rav, lv, dm) +CompleteLinkage::CompleteLinkage(RAbundVector* rav, ListVector* lv, SparseDistanceMatrix* dm, float c, string s) : + Cluster(rav, lv, dm, c, s) {} /***********************************************************************/ -//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(PDistCell& colCell, PDistCell& 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) { - cout << "Standard Error: " << e.what() << " has occurred in the CompleteLinkage class Function update. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "CompleteLinkage", "updateDistance"); 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); - } - } /***********************************************************************/