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