C++ main module for mmsd Package  1.0
LAP_IntegerVector.h
Go to the documentation of this file.
1 #ifndef LAP_IntegerVector_H
2 #define LAP_IntegerVector_H
3 
4 #include "LAP_Vector.h"
5 #include "CORE_ListPointers.h"
6 
7 
17 
18 class LAP_IntegerVector: public LAP_Vector<lapack_int> {
19 
20  SP_OBJECT(LAP_IntegerVector);
21 
22 private:
23  // ATTRIBUTES
24 
25 
26  // ASSOCIATIONS
27 
28  // METHODS
29 
30 
31 public:
32  // CONSTRUCTORS
39 
40 
41  // DESTRUCTORS
44  virtual ~LAP_IntegerVector();
45 
46 public:
47 
48 
49  // -------------
50  // NEW METHODS
51  // -------------
52 public:
55  inline static SP::LAP_IntegerVector New() {
56  SP::LAP_IntegerVector p(new LAP_IntegerVector(),
58  p->setThis(p);
59  return p;
60  };
63  inline static SP::LAP_IntegerVector New(const tLVectorIndex& s) {
64  SP::LAP_IntegerVector p(new LAP_IntegerVector(s),
66  p->setThis(p);
67  return p;
68  };
71  inline static SP::LAP_IntegerVector New(const int& s) {
72  return New((tLVectorIndex)s);
73  };
76  inline static SP::LAP_IntegerVector New(const LAP_IntegerVector& s) {
77  SP::LAP_IntegerVector p(new LAP_IntegerVector(s),
79  p->setThis(p);
80  return p;
81  };
84  inline static SP::LAP_IntegerVector New(SPC::LAP_IntegerVector s) {
85  if (s.get()!=null) {
86  SP::LAP_IntegerVector p(new LAP_IntegerVector(*s.get()),
88  p->setThis(p);
89  return p;
90  } else
91  return New();
92  };
93 
94  //copy operators
95  //===============
99  init(s);
100  return (*this);
101  };
102 
105  inline LAP_IntegerVector& operator=(const vector<lapack_int>& s) {
107  return (*this);
108  };
109 
113  copy(s);
114  return (*this);
115  };
116  //accessor methods
117  //==================
118 
121  virtual tLVectorIndex getNullValuesNumber(const tReal& eps) const {
122  tLVectorIndex n=0;
123  tLVectorIndex i,nvs=getCapacity();
124  const lapack_int *vs=&(*this)[0];
125  for (i=nvs-1;i>0;i--) n+=(vs[i]==0);
126  if (nvs>0) n+=(vs[i]==0);
127  return n;
128  }
129  //computation operators
130  //=====================
135  return(*this);
136  }
137 
141  sub(s);
142  return (*this);
143  };
144 
148  power(s);
149  return (*this);
150  };
155  for (tLVectorIndex i=0;i<n;i++) (*this)(i)/=s;
156  return (*this);
157  };
161  multiplyBy(s);
162  return (*this);
163  };
168  for (tLVectorIndex i=0;i<n;i++) (*this)(i)*=s;
169  return (*this);
170  };
171 
172 
173 
174  //SET methods
175  //============
176 
180  void copy(const LAP_IntegerVector& v);
181 
182 
183 
187  void add(const lapack_real& alpha,const LAP_IntegerVector& x);
188 
191  virtual void add(const tLVectorIndex& i,const lapack_int& v) {
193  };
194 
195 
198  tLVectorIndex indexMax() const;
199 
200 
201 
202 };
203 #endif
tLVectorIndex getCapacity() const
get the capacity
Definition: LAP_Vector.h:524
static SP::LAP_IntegerVector New(const int &s)
create a new vector of double of size s
Definition: LAP_IntegerVector.h:71
Definition: LAP_IntegerVector.h:18
void copy(const LAP_IntegerVector &v)
copy the vector The view is taken into account
Definition: LAP_IntegerVector.cpp:25
void sub(const lapack_int &s)
sub operator
Definition: LAP_Vector.h:166
#define lapack_int
Definition: lapack_functions.h:7
DEFINE_SPTR(LAP_IntegerVector)
#define lapack_real
Definition: lapack_functions.h:9
LAP_IntegerVector & operator*=(const lapack_int &s)
scale operator
Definition: LAP_IntegerVector.h:166
LAP_IntegerVector & operator/=(const lapack_int &s)
division elementt by elementt vector operator
Definition: LAP_IntegerVector.h:153
#define null
Definition: types.h:13
tLVectorIndex indexMax() const
return the i such that |xi| is maximum
Definition: LAP_IntegerVector.cpp:59
void add(const lapack_real &alpha, const LAP_IntegerVector &x)
return this+=alpha. x the view is taken into account
Definition: LAP_IntegerVector.cpp:41
LAP_IntegerVector & operator^=(const lapack_int &s)
power operator
Definition: LAP_IntegerVector.h:147
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_Vector.h:519
virtual ~LAP_IntegerVector()
destroy a vector
Definition: LAP_IntegerVector.cpp:21
this class describes a vector of double
Definition: LAP_Vector.h:16
virtual tLVectorIndex getNullValuesNumber(const tReal &eps) const
Definition: LAP_IntegerVector.h:121
void power(const lapack_int &s)
power operator
Definition: LAP_Vector.h:178
LAP_IntegerVector & operator=(const lapack_int &s)
copy operator the view is taken into account
Definition: LAP_IntegerVector.h:98
virtual void add(const tLVectorIndex &i, const lapack_int &v)
add v to element at index i taking into account the view
Definition: LAP_IntegerVector.h:191
LAP_IntegerVector & operator-=(const lapack_int &s)
sub operator
Definition: LAP_IntegerVector.h:140
virtual void copy(const vector< T > &s)
copy the vector
Definition: LAP_Vector.h:250
#define tLVectorIndex
Definition: lapack_types.h:13
LAP_IntegerVector()
build a vector
Definition: LAP_IntegerVector.cpp:3
DEFINE_SVPTR(LAP_IntegerVector)
LAP_IntegerVector & operator+=(const lapack_int &s)
add operator
Definition: LAP_IntegerVector.h:133
void multiplyBy(const LAP_Vector< lapack_int > &s)
multiplication element by element vector operator
Definition: LAP_Vector.h:208
static SP::LAP_IntegerVector New(const tLVectorIndex &s)
create a new vector of double of size s
Definition: LAP_IntegerVector.h:63
void add(const T &s)
add operator
Definition: LAP_Vector.h:154
static SP::LAP_IntegerVector New(SPC::LAP_IntegerVector s)
create a new copy of s the view is taken into account
Definition: LAP_IntegerVector.h:84
LAP_IntegerVector & operator*=(const LAP_IntegerVector &s)
division elementt by elementt vector operator
Definition: LAP_IntegerVector.h:160
void init(const lapack_int &v)
init the value to v from the view
Definition: LAP_Vector.h:423
LAP_IntegerVector & operator=(const LAP_IntegerVector &s)
copy operator the view is taken into account
Definition: LAP_IntegerVector.h:112
static SP::LAP_IntegerVector New()
create a new vector of double
Definition: LAP_IntegerVector.h:55
#define tReal
Definition: types.h:18
static SP::LAP_IntegerVector New(const LAP_IntegerVector &s)
create a new copy of s the view is taken into account
Definition: LAP_IntegerVector.h:76
LAP_IntegerVector & operator=(const vector< lapack_int > &s)
copy the vector of double
Definition: LAP_IntegerVector.h:105
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106