C++ main module for emicrom Package  1.0
MATH_MaskVector.h
Go to the documentation of this file.
1 #ifndef MATH_MaskVector_H
2 #define MATH_MaskVector_H
3 
4 #include "MATH_Vector.h"
5 
6 
7 
15 
16 class MATH_MaskVector : public MATH_Vector {
18 
19 
20 private:
23 
24 protected:
28  mStartIndex=0;
29  mIncrement=1;
30  }
31 
32 
33 
34  // DESTRUCTORS
35 
36 
39  virtual ~MATH_MaskVector(void) {
40  }
41 
42 public:
46  virtual SP::MATH_Vector NewInstance() const=0;
47 
48  //operators
52  virtual tReal& operator()(const tUIndex& i)=0;
53 
57  virtual const tReal& operator()(const tUIndex& i) const=0;
58  //set methods
59  //===========
60 
64  inline void setIncrement(const tUSInt& inc) {
65  mIncrement=inc;
66  }
70  inline void setStartIndex(const tUIndex& s) {
71  mStartIndex=s;
72  }
73 
74  /* \brief copy method
75  * @param c: vector to copy
76  */
77  virtual void copy(const MATH_Vector& v) {
78 
79  const MATH_MaskVector * mv=dynamic_cast<const MATH_MaskVector*>(&v);
80  if (mv!=null) {
81  mStartIndex=mv->getStartIndex();
82  mIncrement=mv->getIncrement();
83  }
85  }
86 
87 
91  virtual void setCapacity(const tUIndex& n)=0;
92 
96  virtual void init(const tReal& alpha);
97 
103  virtual void init(const tReal& alpha,const MATH_Vector& y);
104 
105 
106 
107  //get methods
108  //============
109 
110 
114  virtual tUIndex getSize() const=0;
115 
119  inline const tUSInt& getIncrement() const {
120  return mIncrement;
121  }
125  inline const tUIndex& getStartIndex() const {
126  return mStartIndex;
127  }
128 
129 
130  //arithmetic operations
131  //========================
132 
133 
137  virtual void add(const MATH_Vector& y);
138 
143  virtual void add(const tReal& alpha,const MATH_Vector& y);
144 
150  virtual void add(const tReal& beta,const MATH_Vector& x,const tReal& alpha);
151 
155  virtual void dot(const tReal& alpha);
156 
161  virtual tReal dot(const MATH_Vector& x) const;
162 
163 
164 
165 
166 
167 
168 };
169 #endif
virtual ~MATH_MaskVector(void)
destroy a vector
Definition: MATH_MaskVector.h:39
DEFINE_SPTR(MATH_MaskVector)
virtual void copy(const MATH_Vector &v)
Definition: MATH_MaskVector.h:77
SP_OBJECT(MATH_MaskVector)
MATH_MaskVector(void)
create a vector
Definition: MATH_MaskVector.h:27
virtual tUIndex getSize() const =0
get the util size taking into account the increment & start index
#define tUSInt
Definition: types.h:28
Definition: MATH_MaskVector.h:16
#define null
Definition: types.h:144
tUIndex mStartIndex
Definition: MATH_MaskVector.h:21
virtual void copy(const MATH_Vector &v)
Definition: MATH_Vector.h:77
virtual tReal & operator()(const tUIndex &i)=0
return the values for element at i taken into account the mask
virtual SP::MATH_Vector NewInstance() const =0
return a share pointer to a new instance of this
virtual void dot(const tReal &alpha)
T*=alpha.
Definition: MATH_MaskVector.cpp:156
const tUIndex & getStartIndex() const
get the start index of the vector
Definition: MATH_MaskVector.h:125
This class describes a masked vector.
Definition: MATH_Vector.h:16
tUSInt mIncrement
Definition: MATH_MaskVector.h:22
const tUSInt & getIncrement() const
get the increment of the vector
Definition: MATH_MaskVector.h:119
#define tUIndex
Definition: types.h:126
void setIncrement(const tUSInt &inc)
set the increment of the vector
Definition: MATH_MaskVector.h:64
virtual void setCapacity(const tUIndex &n)=0
set the size of the vector
virtual void add(const MATH_Vector &y)
T+=y.
Definition: MATH_MaskVector.cpp:220
void setStartIndex(const tUIndex &s)
set the start index of the vector
Definition: MATH_MaskVector.h:70
#define tReal
Definition: types.h:118
virtual void init(const tReal &alpha)
init the values from getStartIndex() index with increment getIncrement() to alpha ...
Definition: MATH_MaskVector.cpp:10