1 #ifndef Mothur_sparsedistancematrix_h
2 #define Mothur_sparsedistancematrix_h
5 // sparsedistancematrix.h
8 // Created by Sarah Westcott on 7/16/12.
9 // Copyright (c) 2012 Schloss Lab. All rights reserved.
13 #include "mothurout.h"
19 /* For each distance in a sparse matrix we have a row, column and distance.
20 The PDistCell consists of the column and distance.
21 We know the row by the distances row in the seqVec matrix.
22 SeqVec is square and each row is sorted so the column values are ascending to save time in the search for the smallest distance. */
24 /***********************************************************************/
29 PDistCellMin(ull r, ull c) : col(c), row(r) {}
31 /***********************************************************************/
35 class SparseDistanceMatrix {
38 SparseDistanceMatrix();
39 ~SparseDistanceMatrix(){ clear(); }
41 ull getSmallestCell(ull& index); //Return the cell with the smallest distance
45 int updateCellCompliment(ull, ull);
46 void resize(ull n) { seqVec.resize(n); }
48 void addCell(ull, PDistCell);
49 vector<vector<PDistCell> > seqVec;
52 PDistCell smallCell; //The cell with the smallest distance
57 float smallDist, aboveCutoff;
62 /***********************************************************************/