]> git.donarmstrong.com Git - mothur.git/blob - sparsematrix.hpp
added mothur.h and fixed includes in many files
[mothur.git] / sparsematrix.hpp
1 #ifndef SPARSEMATRIX_H
2 #define SPARSEMATRIX_H
3
4 #include "utilities.hpp"
5 #include "mothur.h"
6
7
8 class ListVector;
9
10 /***********************************************************************/
11
12
13  struct PCell{
14         ull row;
15         ull column;
16         float dist;
17         PCell** vectorMap;
18         PCell() : row(0), column(0), dist(0), vectorMap(NULL) {};
19         PCell(ull r, ull c, float d) : row(r), column(c), dist(d), vectorMap(NULL) {};
20 };
21
22 /***********************************************************************/
23
24 class SparseMatrix {
25         
26 public:
27         SparseMatrix();
28         int getNNodes();
29         void print();                                   //Print the contents of the matrix
30         void print(ListVector*);                                        //Print the contents of the matrix
31         PCell* getSmallestCell();               //Return the cell with the smallest distance
32         float getSmallDist();
33         
34         void rmCell(list<PCell>::iterator);
35         void addCell(PCell);
36         void clear();
37         list<PCell>::iterator begin();
38         list<PCell>::iterator end();
39
40 private:
41         PCell* smallCell;                               //The cell with the smallest distance
42         int numNodes;
43
44         list<PCell> matrix;
45         
46         vector<PCell*> mins;
47         float smallDist;
48         int minsIndex;
49 };
50
51 /***********************************************************************/
52
53 #endif