Gadget
doublevector.h
Go to the documentation of this file.
1 #ifndef doublevector_h
2 #define doublevector_h
3 
4 #include "mathfunc.h"
5 #include "gadget.h"
6 
11 class DoubleVector {
12 public:
16  DoubleVector() { size = 0; v = 0; };
22  DoubleVector(int sz);
28  DoubleVector(int sz, double initial);
33  DoubleVector(const DoubleVector& initial);
38  ~DoubleVector();
44  void resize(int addsize, double value);
50  void Delete(int pos);
55  int Size() const { return size; };
61  double& operator [] (int pos) { return v[pos]; };
67  const double& operator [] (int pos) const { return v[pos]; };
72  void Reset();
76  void setToZero();
82  double operator * (const DoubleVector& d) const;
88 protected:
92  double* v;
96  int size;
97 };
98 
99 #endif
This class implements a dynamic vector of double values.
Definition: doublevector.h:11
void Delete(int pos)
This will delete an entry from the vector.
Definition: doublevector.cc:64
DoubleVector & operator=(const DoubleVector &d)
This operator will set the vector equal to an existing DoubleVector.
Definition: doublevector.cc:105
double operator*(const DoubleVector &d) const
This operator will calculate the dot product of the vector and an existing DoubleVector.
Definition: doublevector.cc:96
void resize(int addsize, double value)
This will add new entries to the vector.
Definition: doublevector.cc:41
double & operator[](int pos)
This will return the value of an element of the vector.
Definition: doublevector.h:61
double * v
This is the vector of double values.
Definition: doublevector.h:92
void Reset()
This will reset the vector.
Definition: doublevector.cc:82
~DoubleVector()
This is the DoubleVector destructor.
Definition: doublevector.cc:34
void setToZero()
This function will set all of the entries of the vector to zero.
Definition: doublevector.cc:90
int size
This is the size of the vector.
Definition: doublevector.h:96
DoubleVector()
This is the default DoubleVector constructor.
Definition: doublevector.h:16
int Size() const
This will return the size of the vector.
Definition: doublevector.h:55