]> git.donarmstrong.com Git - mothur.git/blobdiff - averagelinkage.cpp
changes while testing
[mothur.git] / averagelinkage.cpp
index 7a4cb88d366d4f9765d906ce0fc7ea27600a6fdd..8627253777c1b09a1b4b16d1ff2ad4f90468248c 100644 (file)
@@ -1,18 +1,18 @@
 #ifndef AVERAGE_H
 #define AVERAGE_H
 
-
+//test
 #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) :
-       Cluster(rav, lv, dm)
+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,12 +37,13 @@ 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) {
-               errorOut(e, "AverageLinkage", "updateDistance");
+               m->errorOut(e, "AverageLinkage", "updateDistance");
                exit(1);
        }
 }