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