]> git.donarmstrong.com Git - mothur.git/blobdiff - averagelinkage.cpp
changes while testing
[mothur.git] / averagelinkage.cpp
index c430c883f66d6006cc9bf01a2a964dd62957688f..8627253777c1b09a1b4b16d1ff2ad4f90468248c 100644 (file)
@@ -5,14 +5,14 @@
 #include "mothur.h"
 #include "cluster.hpp"
 #include "rabundvector.hpp"
-#include "sparsematrix.hpp"
+#include "sparsedistancematrix.h"
 
 /* This class implements the average UPGMA, average neighbor clustering algorithm */
 
 /***********************************************************************/
 
-AverageLinkage::AverageLinkage(RAbundVector* rav, ListVector* lv, SparseMatrix* dm, float c, string s) :
-       Cluster(rav, lv, dm, c, s)
+AverageLinkage::AverageLinkage(RAbundVector* rav, ListVector* lv, SparseDistanceMatrix* dm, float c, string s, float a) :
+Cluster(rav, lv, dm, c, s, a)
 {
        saveRow = -1;
        saveCol = -1;
@@ -28,7 +28,7 @@ string AverageLinkage::getTag() {
 
 /***********************************************************************/
 //This function updates the distance based on the average linkage method.
-bool AverageLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
+bool AverageLinkage::updateDistance(PDistCell& colCell, PDistCell& rowCell) {
        try {
                if ((saveRow != smallRow) || (saveCol != smallCol)) {
                        rowBin = rabund->get(smallRow);
@@ -37,9 +37,9 @@ bool AverageLinkage::updateDistance(MatData& colCell, MatData& rowCell) {
                        saveRow = smallRow;
                        saveCol = smallCol;
                }
-               
-               colCell->dist = (colBin * colCell->dist + rowBin * rowCell->dist) / totalBin;
-               
+               //cout << "colcell.dist = " << colCell.dist << '\t' << smallRow << '\t' << smallCol << '\t' << rowCell.dist << endl;
+               colCell.dist = (colBin * colCell.dist + rowBin * rowCell.dist) / totalBin;
+        
                return(true);
        }
        catch(exception& e) {