C++ main module for mmsd Package  1.0
LAP_DoublePackedStorage.h
Go to the documentation of this file.
1 #ifndef LAP_DoublePackedStorage_H
2 #define LAP_DoublePackedStorage_H
3 
4 
6 
7 
9 
11 
20 
22 
23  SP_OBJECT(LAP_DoublePackedStorage);
24 
25 private:
26  // ATTRIBUTES
27 
28 
29 
30  // ASSOCIATIONS
31 
32  // METHOD
33 
34 
35 public:
36  // CONSTRUCTORS
39  }
40 
41 
42 
43  // DESTRUCTORS
47  }
48 
49 
50 
51 
52 
53  // -------------
54  // NEW METHODS
55  // -------------
56 public:
59  inline static SP::LAP_DoublePackedStorage New() {
60  SP::LAP_DoublePackedStorage p(new LAP_DoublePackedStorage(),
62  p->setThis(p);
63  return p;
64  };
65 
66  //-----------
67  // OPERATORS
68  // ----------
69 
70 
71 public:
72  //accessor operators
73  //===================
74 
77  virtual double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) {
78  return (*this)[i+(j*(j+1)/2)];
79  };
80 
83  virtual const double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) const {
84  return (*this)[i+(j*(j+1)/2)];
85  };
86 
87 
88  //scalar operators
89  //================
90 
94 
101 
105 
106 
110 
111  //pack matrix operator
112  //=====================
113 
120 
127 
134 
141 
142 
143  // copy methods from different storage arrays
144  // ===========================================
145 
146 
150  virtual tBoolean copy(const tBoolean& isSymmetric,
151  const tBoolean& isUpper,
152  const tBoolean& isTransposed,
153  const LAP_DoubleMatrixStorage& x);
154 
157  tBoolean copyFullStorage(const tBoolean& isTransposed,
158  const tLVectorIndex& nViewedRows,
159  const tLVectorIndex& nViewedCols,
160  const tLVectorIncrement& incx,
161  const tLVectorIndex& ldx,
162  const double* x);
166  const double* x);
170  const tLVectorIndex &nUpperBands,
171  const tLVectorIndex &nLowerBands,
172  const double * x);
173 
174 
175  //allocation methods
176  //==================
177 
178 
179 
180 
181 
182  // Values setting
183  // ===============
184 
185 
186 
187 
188 
189  //values getting
190  // =============
191 
192 public:
193 
196  inline tLVectorIndex getDimension() const {
197  return (tLVectorIndex) ((sqrt(1+8*getValuesNumber())-1)/2+0.5);
198  }
199  // ------------------------
200  // operations on matrix
201  // ------------------------
202 public:
203 
206  virtual double trace() const;
207 
210  virtual void addDiagonal(const double& alpha);
211 
212 
215  void add(const double& alpha, const LAP_DoublePackedStorage& B);
216 
217 
218  /* \brief compute the bands number
219  * @param eps:absolute module to detect null value
220  * @return a pair whose firest element is the number of upper bands and the second the lower bands number
221  */
222  virtual std::pair<tLVectorIndex,tLVectorIndex> computeBandsNumber() const {
223  return computeBandsNumber(getValuesNumber(),&(*this)(0,0),ZERO_EPSILON);
224  }
225  /* \brief compute the bands number
226  * @param eps:absolute module to detect null value
227  * @return a pair whose firest element is the number of upper bands and the second the lower bands number
228  */
229  static std::pair<tLVectorIndex,tLVectorIndex> computeBandsNumber(const tLVectorIndex& nX,const double* x,const tReal& eps) ;
230 
231 
237  tReal max(const tFlag& d,const tLVectorIndex& index) const;
238 
243  void indexMin(tLVectorIndex& i,tLVectorIndex& j) const;
244 
245 
246 
247 
248 };
249 #endif
this class describes a packed storage by column
Definition: LAP_DoublePackedStorage.h:21
virtual const double & operator()(const tLVectorIndex &i, const tLVectorIndex &j) const
accessor of element at row i and column j
Definition: LAP_DoublePackedStorage.h:83
void indexMin(tLVectorIndex &i, tLVectorIndex &j) const
get the index of the min view element in absolute value
Definition: LAP_DoublePackedStorage.cpp:718
virtual double & operator()(const tLVectorIndex &i, const tLVectorIndex &j)
accessor of element at row i and column j
Definition: LAP_DoublePackedStorage.h:77
#define tBoolean
Definition: types.h:48
#define lapack_real
Definition: lapack_functions.h:9
tReal max(const tFlag &d, const tLVectorIndex &index) const
make get max among the direction if (d==ROW) max of all the columns of row index if (d==COL) max of a...
Definition: LAP_DoublePackedStorage.cpp:684
virtual tBoolean copy(const tBoolean &isSymmetric, const tBoolean &isUpper, const tBoolean &isTransposed, const LAP_DoubleMatrixStorage &x)
copy the storage
Definition: LAP_DoublePackedStorage.cpp:13
static double ZERO_EPSILON
Definition: LAP_Object.h:21
virtual std::pair< tLVectorIndex, tLVectorIndex > computeBandsNumber() const
compute the bands number of the storage
Definition: LAP_DoublePackedStorage.h:222
tLVectorIndex getDimension() const
get the number of rows of the storage
Definition: LAP_DoublePackedStorage.h:196
LAP_DoublePackedStorage & operator^=(const lapack_real &s)
power by s the matrix viewed term by term taking into account the view
Definition: LAP_DoublePackedStorage.cpp:182
LAP_DoublePackedStorage & operator-=(const lapack_real &s)
sub s to the upper matrix viewed term by term taking into account the view
static SP::LAP_DoublePackedStorage New()
create a new packed storage class
Definition: LAP_DoublePackedStorage.h:59
Definition: LAP_DoubleFullStorage.h:29
LAP_DoublePackedStorage & operator*=(const lapack_real &s)
multiply by s the matrix viewed term by term taking into account the view
tBoolean copyBandStorage(const tLVectorIndex &nX, const tLVectorIndex &nUpperBands, const tLVectorIndex &nLowerBands, const double *x)
copy the upper banded storage
Definition: LAP_DoublePackedStorage.cpp:113
LAP_DoublePackedStorage & operator+=(const lapack_real &s)
add s to the upper matrix viewed term by term taking into account the view
virtual void addDiagonal(const double &alpha)
This += alpha . I.
Definition: LAP_DoublePackedStorage.cpp:729
void add(const double &alpha, const LAP_DoublePackedStorage &B)
This += alpha . B.
Definition: LAP_DoublePackedStorage.cpp:749
tLVectorIndex getValuesNumber() const
get the number of values
Definition: LAP_DoubleMatrixStorage.h:178
LAP_DoublePackedStorage()
build a matrix
Definition: LAP_DoublePackedStorage.h:38
#define tLVectorIndex
Definition: lapack_types.h:13
DEFINE_SPTR(LAP_DoublePackedStorage)
virtual ~LAP_DoublePackedStorage()
destroy a matrix
Definition: LAP_DoublePackedStorage.h:46
tBoolean copyPackStorage(const tLVectorIndex &nX, const double *x)
copy the packed array of memory nx such that nx=n*(n+1)/2 where n is the dimension of the vector stor...
Definition: LAP_DoublePackedStorage.cpp:104
#define tLVectorIncrement
Definition: lapack_types.h:16
Definition: LAP_DoubleMatrixStorage.h:16
#define tReal
Definition: types.h:18
LAP_DoublePackedStorage & operator/=(const lapack_real &s)
divide by s the matrix viewed term by term taking into account the view
virtual double trace() const
return trace
Definition: LAP_DoublePackedStorage.cpp:638
tBoolean copyFullStorage(const tBoolean &isTransposed, const tLVectorIndex &nViewedRows, const tLVectorIndex &nViewedCols, const tLVectorIncrement &incx, const tLVectorIndex &ldx, const double *x)
copy the upper part of full array of size nRows*nCols
Definition: LAP_DoublePackedStorage.cpp:46
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14