]> git.donarmstrong.com Git - mothur.git/blob - sparsematrix.hpp
8eeda7ff2f9899748bde34f92fac5a25dcfd3964
[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 typedef list<PCell>::iterator MatData;
24
25 class SparseMatrix {
26         
27 public:
28         SparseMatrix();
29         int getNNodes();
30         void print();                                   //Print the contents of the matrix
31         void print(ListVector*);                //Print the contents of the matrix
32         PCell* getSmallestCell();               //Return the cell with the smallest distance
33         float getSmallDist();
34         
35         MatData rmCell(MatData);
36         void addCell(PCell);
37         void clear();
38         MatData begin();
39         MatData end();
40
41 private:
42         PCell* smallCell;                               //The cell with the smallest distance
43         int numNodes;
44
45         list<PCell> matrix;
46         
47         vector<PCell*> mins;
48         float smallDist;
49         int minsIndex;
50 };
51
52 /***********************************************************************/
53
54 #endif