Gadget
intmatrix.h
Go to the documentation of this file.
1 #ifndef intmatrix_h
2 #define intmatrix_h
3 
4 #include "intvector.h"
5 
10 class IntMatrix {
11 public:
15  IntMatrix() { nrow = 0; v = 0; };
22  IntMatrix(int nr, int nc, int initial);
27  IntMatrix(const IntMatrix& initial);
32  ~IntMatrix();
39  int Ncol(int i = 0) const { return v[i]->Size(); };
44  int Nrow() const { return nrow; };
50  IntVector& operator [] (int pos) { return *v[pos]; };
56  const IntVector& operator [] (int pos) const { return *v[pos]; };
63  void AddRows(int add, int length, int value);
69  void Delete(int pos);
74  void Reset();
78  void setToZero();
83  void Print(ofstream& outfile) const;
88  IntMatrix& operator = (const IntMatrix& initial);
89 protected:
93  int nrow;
98 };
99 
100 #endif
This class implements a dynamic vector of IntVector values.
Definition: intmatrix.h:10
IntVector ** v
This is the vector of IntVector values.
Definition: intmatrix.h:97
IntMatrix()
This is the default IntMatrix constructor.
Definition: intmatrix.h:15
void Delete(int pos)
This will delete an entry from the vector.
Definition: intmatrix.cc:57
void Reset()
This will reset the vector.
Definition: intmatrix.cc:96
void setToZero()
This function will set all of the entries of the vector to zero.
Definition: intmatrix.cc:117
int Ncol(int i=0) const
This will return the number of columns in row i of the vector.
Definition: intmatrix.h:39
void Print(ofstream &outfile) const
This function will print the data stored in the vector.
Definition: intmatrix.cc:107
int Nrow() const
This will return the number of rows of the vector.
Definition: intmatrix.h:44
int nrow
This is number of rows of the vector.
Definition: intmatrix.h:93
IntVector & operator[](int pos)
This will return the value of an element of the vector.
Definition: intmatrix.h:50
IntMatrix & operator=(const IntMatrix &initial)
This operator will set the vector equal to an existing IntMatrix.
Definition: intmatrix.cc:76
~IntMatrix()
This is the IntMatrix destructor.
Definition: intmatrix.cc:24
void AddRows(int add, int length, int value)
This will add new entries to the vector.
Definition: intmatrix.cc:34
This class implements a dynamic vector of int values.
Definition: intvector.h:11
int Size() const
This will return the size of the vector.
Definition: intvector.h:49