7 #include "rabundvector.hpp"
8 #include "sparsematrix.hpp"
10 /* This class implements the average UPGMA, average neighbor clustering algorithm */
12 /***********************************************************************/
14 AverageLinkage::AverageLinkage(RAbundVector* rav, ListVector* lv, SparseMatrix* dm) :
22 /***********************************************************************/
23 //This function returns the tag of the method.
24 string AverageLinkage::getTag() {
29 /***********************************************************************/
30 //This function updates the distance based on the average linkage method.
31 bool AverageLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
33 if ((saveRow != smallRow) || (saveCol != smallCol)) {
34 rowBin = rabund->get(smallRow);
35 colBin = rabund->get(smallCol);
36 totalBin = rowBin + colBin;
41 colCell->dist = (colBin * colCell->dist + rowBin * rowCell->dist) / totalBin;
45 errorOut(e, "AverageLinkage", "updateDistance");
50 /***********************************************************************/
53 /***********************************************************************/