Gadget
doublematrix.h
Go to the documentation of this file.
1 #ifndef doublematrix_h
2 #define doublematrix_h
3 
4 #include "doublevector.h"
5 #include "intvector.h"
6 
11 class DoubleMatrix {
12 public:
16  DoubleMatrix() { nrow = 0; v = 0; };
23  DoubleMatrix(int nr, int nc, double initial);
28  DoubleMatrix(const DoubleMatrix& initial);
33  ~DoubleMatrix();
40  int Ncol(int i = 0) const { return v[i]->Size(); };
45  int Nrow() const { return nrow; };
51  DoubleVector& operator [] (int pos) { return *v[pos]; };
57  const DoubleVector& operator [] (int pos) const { return *v[pos]; };
64  void AddRows(int add, int length, double value);
70  void Delete(int pos);
75  void Reset();
79  void setToZero();
84  void Print(ofstream& outfile) const;
90 protected:
94  int nrow;
99 };
100 
101 #endif
This class implements a dynamic vector of DoubleVector values.
Definition: doublematrix.h:11
int nrow
This is number of rows of the vector.
Definition: doublematrix.h:94
void Print(ofstream &outfile) const
This function will print the data stored in the vector.
Definition: doublematrix.cc:112
~DoubleMatrix()
This is the DoubleMatrix destructor.
Definition: doublematrix.cc:29
DoubleVector & operator[](int pos)
This will return the value of an element of the vector.
Definition: doublematrix.h:51
int Ncol(int i=0) const
This will return the number of columns in row i of the vector.
Definition: doublematrix.h:40
DoubleMatrix()
This is the default DoubleMatrix constructor.
Definition: doublematrix.h:16
void Reset()
This will reset the vector.
Definition: doublematrix.cc:101
DoubleMatrix & operator=(const DoubleMatrix &d)
This operator will set the vector equal to an existing DoubleMatrix.
Definition: doublematrix.cc:81
DoubleVector ** v
This is the vector of DoubleVector values.
Definition: doublematrix.h:98
void AddRows(int add, int length, double value)
This will add new entries to the vector.
Definition: doublematrix.cc:39
void setToZero()
This function will set all of the entries of the vector to zero.
Definition: doublematrix.cc:122
void Delete(int pos)
This will delete an entry from the vector.
Definition: doublematrix.cc:62
int Nrow() const
This will return the number of rows of the vector.
Definition: doublematrix.h:45
This class implements a dynamic vector of double values.
Definition: doublevector.h:11
int Size() const
This will return the size of the vector.
Definition: doublevector.h:55