C++ main module for mmsd Package  1.0
MMSD_DoubleSymmetricMatrix.h
Go to the documentation of this file.
1 #ifndef MMSD_DoubleSymmetricMatrix_H
2 #define MMSD_DoubleSymmetricMatrix_H
3 
4 #include "MMSD_Object.h"
5 
6 #include "MMSD_DoubleVector.h"
9 
11 
21 
23 
24  SP_OBJECT(MMSD_DoubleSymmetricMatrix);
25 
26 public:
29  static const tFlag PACKED_STORAGE;
32  static const tFlag FULL_STORAGE;
33 
34 
35 
36 private:
37  // ATTRIBUTES
38 
39  // ASSOCIATIONS
40 
41  SP::LAP_DoubleFullSymmetricMatrix mFullStorage;
42  SP::LAP_DoublePackedSymmetricMatrix mPackedStorage;
43 
44 
45 
46 
47  // METHOD
48 
49 
50 public:
51  // CONSTRUCTORS
54 
55 
56  // DESTRUCTORS
60 
61 
62 
63  // -------------
64  // NEW METHODS
65  // -------------
66 public:
67 
68  inline static SP::MMSD_DoubleSymmetricMatrix New() {
69  SP::MMSD_DoubleSymmetricMatrix p(new MMSD_DoubleSymmetricMatrix(),
71  p->setThis(p);
72  return p;
73  };
74 
75 
76 
77 
78 
79  //-----------
80  // OPERATORS
81  // ----------
82 
86  inline double& operator()(const size_t& i,const size_t& j) {
87  return (mFullStorage.get()!=null)?(*mFullStorage.get())(i,j):(*mPackedStorage.get())(i,j);
88  };
89 
93  inline const double& operator()(const size_t& i,const size_t& j) const {
94  return (mFullStorage.get()!=null)?(*mFullStorage)(i,j):(*mPackedStorage.get())(i,j);
95  };
99  const LAP_DoubleFullSymmetricMatrix *fsy=dynamic_cast< const LAP_DoubleFullSymmetricMatrix *>(&s);
100  const LAP_DoublePackedSymmetricMatrix *psy=dynamic_cast< const LAP_DoublePackedSymmetricMatrix *>(&s);
101  if (mFullStorage!=null) {
102  if (fsy!=null) (*mFullStorage)*=(*fsy);
103  else if (psy!=null) (*mFullStorage)*=(*psy);
104  } else if (mPackedStorage!=null) {
105  if (fsy!=null) (*mPackedStorage)*=(*fsy);
106  else if (psy!=null) (*mPackedStorage)*=(*psy);
107  }
108  return (*this);
109  };
113  if (mFullStorage.get()!=null) (*mFullStorage.get())*=s;
114  else if (mPackedStorage.get()!=null) (*mPackedStorage.get())*=s;
115  return (*this);
116  };
120  if (mFullStorage.get()!=null) (*mFullStorage.get())/=s;
121  else if (mPackedStorage.get()!=null) (*mPackedStorage.get())/=s;
122  return (*this);
123  };
124 
128  if (mFullStorage.get()!=null) (*mFullStorage.get())+=s;
129  else if (mPackedStorage.get()!=null) (*mPackedStorage.get())+=s;
130 
131  return (*this);
132  };
136  if (mFullStorage.get()!=null) (*mFullStorage.get())-=s;
137  else if (mPackedStorage.get()!=null) (*mPackedStorage.get())-=s;
138  return (*this);
139  };
143  if (mFullStorage.get()!=null) (*mFullStorage.get())^=s;
144  else if (mPackedStorage.get()!=null) (*mPackedStorage.get())^=s;
145  return (*this);
146  };
147 
148 
152  if (mFullStorage.get()!=null) (*mFullStorage.get())=s;
153  else if (mPackedStorage.get()!=null) (*mPackedStorage.get())=s;
154  return (*this);
155  };
159  if (mFullStorage.get()!=null) mFullStorage->copy(s.getMatrix());
160  else if (mPackedStorage.get()!=null) mPackedStorage->copy(s.getMatrix());
161  return (*this);
162  };
166  if (mFullStorage!=null) mFullStorage->copy(s);
167  else if (mPackedStorage.get()!=null) mPackedStorage->copy(s);
168  return (*this);
169  };
173  if (mFullStorage.get()!=null) mFullStorage->copy(s);
174  else if (mPackedStorage.get()!=null) mPackedStorage->copy(s);
175  return (*this);
176  };
180  if (mFullStorage.get()!=null) mFullStorage->copy(s);
181  else if (mPackedStorage.get()!=null) mPackedStorage->copy(s);
182  return (*this);
183  };
184 
185 
186 
187  // ----------------
188  // MATRIX SETTINGS
189  // ----------------
190 public:
194  virtual void copy(const LAP_DoubleMatrix& x);
195 
199  void copy(const MMSD_DoubleSymmetricMatrix& x);
200 
204  void copy(SP::MMSD_DoubleSymmetricMatrix x) {
205  if (x.get()!=null) copy(*x.get());
206  }
207 
211  void copy(const LAP_DoubleFullSymmetricMatrix& x);
212 
216  void copy(const LAP_DoublePackedSymmetricMatrix& x);
217 
221  void copy(const LAP_DoubleFullGeneralMatrix& x);
222 
225  inline const LAP_DoubleVector& getValues() const {
226  return getMatrix().getStorage().getValues();
227  };
230  inline void setValues(SP::MMSD_DoubleVector values) {
231  getMatrix().setValues(values);
232  };
233 
234 
237  inline int getValuesNumber() const {
238  return getMatrix().getValuesNumber();
239  }
240 
243  inline const LAP_DoubleSymmetricMatrix& getMatrix() const {
244  if (mFullStorage.get()!=null) {
245  return (*mFullStorage.get());
246  }
247  return (*mPackedStorage.get());
248 
249  };
250 
254  if (mFullStorage.get()!=null) {
255  return (*mFullStorage.get());
256  }
257  return (*mPackedStorage.get());
258 
259 
260  };
261 
262  inline size_t getSize() const {
264  }
267  void setStorage(const tFlag& storageType);
270  inline tFlag getStorage() const {
271  if (mFullStorage.get()!=null) return FULL_STORAGE;
272  else return PACKED_STORAGE;
273  }
274 
278  virtual void setSize(const size_t& n) {
279  if (mFullStorage.get()!=null) mFullStorage->setSize(n);
280  else if (mPackedStorage.get()!=null) mPackedStorage->setSize(n);
281 
282  }
286  virtual void setSize(const size_t& n,const size_t& p) {
287  if (mFullStorage.get()!=null) mFullStorage->setSize(n,p);
288  else if (mPackedStorage.get()!=null) mPackedStorage->setSize(n,p);
289  }
290 
291 
294  virtual void getColumn(const size_t& j,LAP_DoubleVector& v) const {
295  if (mFullStorage.get()!=null) mFullStorage->getColumn(j,v);
296  else if (mPackedStorage.get()!=null) mPackedStorage->getColumn(j,v);
297  }
300  virtual void getColumn(const size_t& j,SP::LAP_DoubleVector v) const {
301  if (mFullStorage.get()!=null) mFullStorage->getColumn(j,v);
302  else if (mPackedStorage.get()!=null) mPackedStorage->getColumn(j,v);
303  };
304 
307  inline size_t getRowsNumber() const {
308  if (mFullStorage.get()!=null) return mFullStorage->getRowsNumber();
309  else if (mPackedStorage.get()!=null) return mPackedStorage->getRowsNumber();
310  return 0;
311  };
314  inline size_t getSize(const tFlag& d) const {
315  if (mFullStorage.get()!=null) return mFullStorage->getSize(d);
316  else if (mPackedStorage.get()!=null) return mPackedStorage->getSize(d);
317  return 0;
318  };
321  inline size_t getColumnsNumber() const {
322  if (mFullStorage.get() !=null) return mFullStorage->getColumnsNumber();
323  else if (mPackedStorage.get()!=null) return mPackedStorage->getColumnsNumber();
324  return 0;
325  };
326 
329  virtual void set(const size_t& i,
330  const size_t& j,
331  const double& v) {
332  (*this)(i,j)=v;
333  };
334 
335 
338  virtual double get(const size_t& i,
339  const size_t& j) const {
340  return (*this)(i,j);
341  }
342 
345  virtual void add(const size_t& i,
346  const size_t& j,
347  const double& v) {
348  (*this)(i,j)+=v;
349  }
350 
354  inline void setValues(const size_t& n,const double* values) {
355  if (mFullStorage.get()!=null) mFullStorage->setValues(n,values);
356  else if (mPackedStorage.get()!=null) mPackedStorage->setValues(n,values);
357  }
358 
359  // ----------------
360  // vector product
361  // ----------------
362 
363 public:
364 
365 
368  void product(const LAP_DoubleVector& vect,
369  LAP_DoubleVector& result) const {
370  if (mFullStorage.get() !=null) mFullStorage->vectorProduct(vect,result);
371  else if (mPackedStorage.get()!=null) mPackedStorage->vectorProduct(vect,result);
372  };
375  void product(const LAP_ConstDoubleVector& vect,
376  LAP_DoubleVector& result) const {
377  tLVectorIndex n=vect.getSize();
378  result.setSize(n);
379  if (mFullStorage.get() !=null)
380  mFullStorage->vectorProduct(false,
381  n,vect.getIncrement(),&vect(0),1,0,
382  n,result.getIncrement(),&result(0));
383  else if (mPackedStorage.get()!=null)
384  mPackedStorage->vectorProduct(false,
385  n,vect.getIncrement(),&vect(0),1,0,
386  n,result.getIncrement(),&result(0));
387  }
388 
391  void product(SPC::LAP_DoubleVector vect,
392  SP::LAP_DoubleVector result) const {
393  if (mFullStorage.get() !=null) mFullStorage->vectorProduct(*vect.get(),*result.get());
394  else if (mPackedStorage.get()!=null) mPackedStorage->vectorProduct(*vect.get(),*result.get());
395  };
396 
399  virtual void product(const LAP_DoubleVector& vect,
400  const lapack_real& alpha,
401  const lapack_real& beta,
402  LAP_DoubleVector& result) const {
403  if (mFullStorage.get() !=null) mFullStorage->vectorProduct(vect,alpha,beta,result);
404  else if (mPackedStorage.get()!=null) mPackedStorage->vectorProduct(vect,alpha,beta,result);
405  };
406 
407 
408  virtual void rankSymmetricProduct(const lapack_real& alpha,const LAP_DoubleVector& vect) {
409  if (mFullStorage.get() !=null) {
410  mFullStorage->dotProduct(alpha,vect);
411  }
412  else if (mPackedStorage.get()!=null) mPackedStorage->dotProduct(alpha,vect);
413  }
414 
415  // ----------------
416  // matrix product
417  // ----------------
421  LAP_DoubleFullGeneralMatrix& C) const {
423  if (mFullStorage.get() !=null) {
424  const LAP_DoubleFullSymmetricMatrix* fB=dynamic_cast<const LAP_DoubleFullSymmetricMatrix*>(&B);
425  if (fB!=null) {
426  mFullStorage->matrixProduct(true,*mFullStorage,*fB,1.,0.,C);
427  return true;
428  }
429  const LAP_DoublePackedSymmetricMatrix* pB=dynamic_cast<const LAP_DoublePackedSymmetricMatrix*>(&B);
430  if (pB!=null) {
431  pB->matrixProduct(false,*mFullStorage,1.,0.,C);
432  return true;
433  }
434  return false;
435  }
436  else if (mPackedStorage.get()!=null) {
437  const LAP_DoubleFullSymmetricMatrix* fB=dynamic_cast<const LAP_DoubleFullSymmetricMatrix*>(&B);
438  if (fB!=null) {
439  mPackedStorage->matrixProduct(true,*fB,1.,0.,C);
440  return true;
441  }
442  const LAP_DoublePackedSymmetricMatrix* pB=dynamic_cast<const LAP_DoublePackedSymmetricMatrix*>(&B);
443  if (pB!=null) {
444  mPackedStorage->matrixProduct(*pB,C);
445  return true;
446  }
447  return false;
448  }
449  return false;
450 
451  };
455  LAP_DoubleFullGeneralMatrix& C) const {
456 
457  if (mFullStorage.get()!=null) mFullStorage->matrixProduct(B,C);
458  else if (mPackedStorage.get()!=null) mPackedStorage->matrixProduct(B,C);
459  };
462  virtual void product(const LAP_DoubleFullGeneralMatrix& B,
463  const lapack_real& alpha,
464  const lapack_real& beta,
465  LAP_DoubleFullGeneralMatrix& C) const {
466  if (mFullStorage.get() !=null) mFullStorage->matrixProduct(B,alpha,beta,C);
467  else if (mPackedStorage.get()!=null) mPackedStorage->matrixProduct(true,B,alpha,beta,C);
468  };
469 
474  virtual tBoolean product(const tBoolean& leftSide,
476  const lapack_real& alpha,
477  const lapack_real& beta,
478  LAP_DoubleFullGeneralMatrix& C) const {
479  if (mFullStorage.get() !=null) {
480  mFullStorage->matrixProduct(leftSide,B,alpha,beta,C);
481  return true;
482  }
483  else if (mPackedStorage.get()!=null) {
484  mPackedStorage->matrixProduct(leftSide,B,alpha,beta,C);
485  return true;
486  }
487  return false;
488 
489  }
490 
495  static void product(const tBoolean& leftSide,
498  const lapack_real& alpha,
499  const lapack_real& beta,
501  const LAP_DoubleFullSymmetricMatrix *fsy=dynamic_cast<const LAP_DoubleFullSymmetricMatrix *>(&A.getMatrix());
502  const LAP_DoublePackedSymmetricMatrix *psy=dynamic_cast<const LAP_DoublePackedSymmetricMatrix *>(&A.getMatrix());
503 
504  if (fsy!=null) LAP_DoubleFullSymmetricMatrix::matrixProduct(leftSide,*fsy,B,alpha,beta,C);
505  if (psy!=null) LAP_DoublePackedSymmetricMatrix::matrixProduct(leftSide,*psy,B,alpha,beta,C);
506  };
507 
508 
509 
510 
511  // ----------------------
512  // eigen values & vectors
513  // ------------------------
514 public:
518  if (mFullStorage.get()!=null) {
519  LAP_DoubleFullSymmetricMatrix C(*mFullStorage);
521  } else if (mPackedStorage.get()!=null) {
522  LAP_DoublePackedSymmetricMatrix C(*mPackedStorage);
524  }
525  return false;
526  };
527 
528 
529 
530 public:
531 
532 
533 
539  LAP_DoubleFullGeneralMatrix& VR) const {
540  if (mFullStorage.get()!=null) {
541  return mFullStorage->computeEigenValueDecomposition(U,VR);
542  } else if (mPackedStorage.get()!=null) {
543  return mPackedStorage->computeEigenValueDecomposition(U,VR);
544  }
545  return false;
546  };
547 
548 
555  LAP_DoubleVector& U,
558  if (psy!=null) {
560  }
562  if (fsy!=null) {
563  return LAP_DoubleFullSymmetricMatrix::computeEigenValueDecomposition(*fsy,U,VR);
564  }
565  return false;
566  };
567 
568 
569 
576  const int& il,const int& iu) const {
577  if (mFullStorage.get()!=null) {
578  LAP_DoubleFullSymmetricMatrix C(*mFullStorage);
579  return mFullStorage->computeEigenValueDecomposition(C,U,VR,il,iu);
580  } else if (mPackedStorage.get()!=null) {
581  LAP_DoublePackedSymmetricMatrix C(*mPackedStorage);
582  return mPackedStorage->computeEigenValueDecomposition(C,U,VR,il,iu);
583  }
584  return false;
585  };
586 
596  LAP_DoubleVector& U,
598  const lapack_int &il,const lapack_int& ul) {
600  if (psy!=null) {
602  }
604  if (fsy!=null) {
605  return LAP_DoubleFullSymmetricMatrix::computeEigenValueDecomposition(*fsy,U,Z,il,ul);
606  }
607  return false;
608  };
609 
610 
611 
612 
613 
614  // ------------------------
615  // operation on matrix
616  // ------------------------
617 public:
620  virtual tReal norm2() const {
621  if (mFullStorage.get()!=null) return mFullStorage->norm2();
622  else if (mPackedStorage.get()!=null) return mPackedStorage->norm2();
623  return 0;
624  }
625 
628  virtual tReal norm2(LAP_DoubleVector& v) const {
629  if (mFullStorage.get()!=null) return mFullStorage->norm2(v);
630  else if (mPackedStorage.get()!=null) return mPackedStorage->norm2(v);
631  return 0;
632  };
633 
634 
635 
640  virtual tReal sum(const tFlag& d,LAP_DoubleVector& s) const {
641  if (mFullStorage.get()!=null) return mFullStorage->sum(d,s);
642  else if (mPackedStorage.get()!=null) return mPackedStorage->sum(d,s);
643  return 0;
644 
645  };
646 
651  virtual tReal sum(const tFlag& d,const int& index) const {
652  if (mFullStorage.get()!=null) return mFullStorage->sum(d,index);
653  else if (mPackedStorage.get()!=null) return mPackedStorage->sum(d,index);
654  return 0;
655 
656  };
657 
660  virtual tReal trace() const {
661  if (mFullStorage.get()!=null) return mFullStorage->trace();
662  else if (mPackedStorage.get()!=null) return mPackedStorage->trace();
663  return 0;
664  };
665 
666  // -----------------
667  // Orthogonalization
668  // ------------------
669 public:
672  void orthogonalTransformation(const int& n,
673  const double& errorMax,
675 private:
676  void FStepForFluryGautshiAlgorithm(const MMSD_DoubleSymmetricMatrix& A,
677  const int& n,
678  const double& errorMax,
680  void GStepForFluryGautshiAlgorithm(const MMSD_DoubleFullMatrix& T,
681  const int& n,
682  const double& errorMax,
684 
685  // -----------------------
686  // STRING Representation
687  // ----------------------
688 public:
691  virtual tString toString() const {
692  if (mFullStorage.get()!=null) return mFullStorage->toString();
693  else if (mPackedStorage.get()!=null) return mPackedStorage->toString();
694  return "";
695  };
696 
697 };
698 #endif
const LAP_DoubleVector & getValues() const
get the values of the symmetric matrix
Definition: MMSD_DoubleSymmetricMatrix.h:225
virtual tReal sum(const tFlag &d, LAP_DoubleVector &s) const
make the sum among the direction if (d==ROW) sum all the rows and size of s if the number of rows if ...
Definition: MMSD_DoubleSymmetricMatrix.h:640
MMSD_DoubleSymmetricMatrix & operator*=(const lapack_real &s)
scale operator
Definition: MMSD_DoubleSymmetricMatrix.h:112
virtual void setSize(const size_t &n, const size_t &p)
set the dimension of the matrix
Definition: MMSD_DoubleSymmetricMatrix.h:286
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This: A is copied in ascending order
Definition: LAP_DoublePackedSymmetricMatrix.h:870
LAP_DoubleMatrixStorage & getStorage()
set the storage
Definition: LAP_DoubleMatrix.h:179
this class describes a full symmetric matrix for lapack used
Definition: LAP_DoubleFullSymmetricMatrix.h:31
MMSD_DoubleSymmetricMatrix & operator+=(const lapack_real &s)
add operator
Definition: MMSD_DoubleSymmetricMatrix.h:127
virtual tString toString() const
print the matrix taking into account the view
Definition: MMSD_DoubleSymmetricMatrix.h:691
this class describes a general double symmetric matrix
Definition: LAP_DoubleSymmetricMatrix.h:21
MMSD_DoubleSymmetricMatrix & operator/=(const lapack_real &s)
divide operator
Definition: MMSD_DoubleSymmetricMatrix.h:119
MMSD_DoubleSymmetricMatrix & operator=(const MMSD_DoubleSymmetricMatrix &s)
init all the matrix to s
Definition: MMSD_DoubleSymmetricMatrix.h:158
virtual void getColumn(const size_t &j, SP::LAP_DoubleVector v) const
get the j-th column of this symmetric matrix in a vector
Definition: MMSD_DoubleSymmetricMatrix.h:300
const LAP_DoubleSymmetricMatrix & getMatrix() const
get its matrix form
Definition: MMSD_DoubleSymmetricMatrix.h:243
size_t getSize() const
Definition: MMSD_DoubleSymmetricMatrix.h:262
MMSD_DoubleSymmetricMatrix & operator=(const double &s)
init all the matrix to s
Definition: MMSD_DoubleSymmetricMatrix.h:151
virtual void product(const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B (lefside=true) or B. (this) (lefside=false)
Definition: MMSD_DoubleSymmetricMatrix.h:462
static tBoolean computeEigenValues(LAP_DoubleFullSymmetricMatrix &A, LAP_DoubleVector &U)
compute the eigen values of A in ascending order and A is destroyed after method lapack method dsyev ...
Definition: LAP_DoubleFullSymmetricMatrix.h:869
virtual tReal sum(const tFlag &d, const int &index) const
make the sum among the direction if (d==ROW) sum all the rows and size of s if the number of rows if ...
Definition: MMSD_DoubleSymmetricMatrix.h:651
virtual void set(const size_t &i, const size_t &j, const double &v)
set the value taking into account the view
Definition: MMSD_DoubleSymmetricMatrix.h:329
MMSD_DoubleSymmetricMatrix & operator=(const LAP_DoubleFullGeneralMatrix &s)
init all the matrix to s
Definition: MMSD_DoubleSymmetricMatrix.h:179
LAP_DoubleSymmetricMatrix & getMatrix()
get its matrix form
Definition: MMSD_DoubleSymmetricMatrix.h:253
MMSD_DoubleSymmetricMatrix & operator^=(const lapack_real &s)
power operator
Definition: MMSD_DoubleSymmetricMatrix.h:142
This class describes the FullMatrix class.
Definition: MMSD_DoubleFullMatrix.h:17
Definition: LAP_DoubleVector.h:20
#define lapack_int
Definition: lapack_functions.h:7
Definition: LAP_DoubleMatrix.h:18
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This: This is copied
Definition: MMSD_DoubleSymmetricMatrix.h:517
void setStorage(const tFlag &storageType)
get its matrix form
Definition: MMSD_DoubleSymmetricMatrix.cpp:55
void copy(SP::MMSD_DoubleSymmetricMatrix x)
copy a matrix the view is taken into account
Definition: MMSD_DoubleSymmetricMatrix.h:204
MMSD_DoubleSymmetricMatrix()
build a matrix
Definition: MMSD_DoubleSymmetricMatrix.cpp:10
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_ConstVector.h:170
virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix &B) const
return C=(This) . B
Definition: LAP_DoubleFullSymmetricMatrix.h:679
void setValues(const size_t &n, const double *values)
set the values values is orderd by column
Definition: MMSD_DoubleSymmetricMatrix.h:354
void product(const LAP_ConstDoubleVector &vect, LAP_DoubleVector &result) const
return result=this.vector
Definition: MMSD_DoubleSymmetricMatrix.h:375
tLVectorIndex getValuesNumber() const
get the number of values
Definition: LAP_DoubleMatrix.h:281
#define tBoolean
Definition: types.h:48
virtual tReal trace() const
return the trace of the symmetric matrix
Definition: MMSD_DoubleSymmetricMatrix.h:660
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix and allocate the values array
Definition: LAP_DoubleFullGeneralMatrix.h:230
#define lapack_real
Definition: lapack_functions.h:9
static const tFlag ROW
Definition: LAP_Matrix.h:21
virtual tBoolean product(const tBoolean &leftSide, const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C) const
make the product C = alpha. A . B +beta C if leftSide=true C = alpha. B . A +beta C if leftSide=false...
Definition: MMSD_DoubleSymmetricMatrix.h:474
void setValues(SP::MMSD_DoubleVector values)
set the values of the symmetric matrix
Definition: MMSD_DoubleSymmetricMatrix.h:230
#define null
Definition: types.h:13
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_Vector.h:529
MMSD_DoubleSymmetricMatrix & operator=(const LAP_DoublePackedSymmetricMatrix &s)
init all the matrix to s
Definition: MMSD_DoubleSymmetricMatrix.h:172
virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix &B) const
return C=(This) . B
Definition: LAP_DoublePackedSymmetricMatrix.h:627
static tBoolean computeEigenValueDecomposition(MMSD_DoubleSymmetricMatrix &A, LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &Z, const lapack_int &il, const lapack_int &ul)
compute the eigen elements of A A is supposed to be symmetric, the eigen vectors are set in Z...
Definition: MMSD_DoubleSymmetricMatrix.h:595
Definition: LAP_DoubleFullGeneralMatrix.h:30
void orthogonalTransformation(const int &n, const double &errorMax, MMSD_DoubleSymmetricMatrix &H)
make the orthogonalization of this
Definition: MMSD_DoubleSymmetricMatrix.cpp:72
virtual tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &VR) const
compute the eigen values decomposition on This
Definition: MMSD_DoubleSymmetricMatrix.h:538
static void product(const tBoolean &leftSide, const MMSD_DoubleSymmetricMatrix &A, const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C)
make the product C = alpha. A . B +beta C if leftSide=true C = alpha. B . A +beta C if leftSide=false...
Definition: MMSD_DoubleSymmetricMatrix.h:495
virtual ~MMSD_DoubleSymmetricMatrix()
destroy a matrix
Definition: MMSD_DoubleSymmetricMatrix.cpp:17
tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &VR, const int &il, const int &iu) const
compute the eigen elements of This supposed to be symmetric, the eigen vectors are set in Z...
Definition: MMSD_DoubleSymmetricMatrix.h:574
static const tFlag PACKED_STORAGE
to store symmetric matrix in a packed storage form
Definition: MMSD_DoubleSymmetricMatrix.h:29
double & operator()(const size_t &i, const size_t &j)
accessor of element at row i and column j taking into account the view only use the upper diagonal ...
Definition: MMSD_DoubleSymmetricMatrix.h:86
virtual void setSize(const size_t &n)
set the dimension of the matrix
Definition: MMSD_DoubleSymmetricMatrix.h:278
const tLVectorIndex & getSize(const tFlag &direction) const
get the size in direction
Definition: LAP_Matrix.h:108
tFlag getStorage() const
get its matrix form
Definition: MMSD_DoubleSymmetricMatrix.h:270
size_t getRowsNumber() const
get the rows number
Definition: MMSD_DoubleSymmetricMatrix.h:307
const double & operator()(const size_t &i, const size_t &j) const
accessor of element at row i and column j taking into account the view only use the upper diagonal ...
Definition: MMSD_DoubleSymmetricMatrix.h:93
int getValuesNumber() const
get the values number
Definition: MMSD_DoubleSymmetricMatrix.h:237
tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &W) const
compute the eigen elements in ascending order of This the eigen vectors are set in This: This is dest...
Definition: LAP_DoublePackedSymmetricMatrix.h:894
#define tLVectorIndex
Definition: lapack_types.h:13
DEFINE_SPTR(MMSD_DoubleFullMatrix)
this class describes a packed symmetric matrix for lapack used where values are stored in vector: {A(...
Definition: LAP_DoublePackedSymmetricMatrix.h:31
#define tString
Definition: types.h:49
virtual void product(const LAP_DoubleVector &vect, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleVector &result) const
return result=beta.result+alpha.this.vector
Definition: MMSD_DoubleSymmetricMatrix.h:399
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
size_t getColumnsNumber() const
get the rows number
Definition: MMSD_DoubleSymmetricMatrix.h:321
virtual void rankSymmetricProduct(const lapack_real &alpha, const LAP_DoubleVector &vect)
Definition: MMSD_DoubleSymmetricMatrix.h:408
virtual void copy(const LAP_DoubleMatrix &x)
copy a matrix the view is taken into account
Definition: MMSD_DoubleSymmetricMatrix.cpp:25
virtual tReal norm2() const
return norm2 sqrt(sum_ij(aij^2))=sqrt(tr(AtA));
Definition: MMSD_DoubleSymmetricMatrix.h:620
const LAP_DoubleVector & getValues() const
get the vector values of the matrix
Definition: LAP_DoubleMatrixStorage.h:197
DEFINE_SVPTR(MMSD_DoubleSymmetricMatrix)
MMSD_DoubleSymmetricMatrix & operator-=(const lapack_real &s)
sub operator
Definition: MMSD_DoubleSymmetricMatrix.h:135
virtual void setValues(SP::LAP_DoubleVector v)
set the values of the matrix
Definition: LAP_DoubleMatrix.h:153
static SP::MMSD_DoubleSymmetricMatrix New()
Definition: MMSD_DoubleSymmetricMatrix.h:68
virtual void getColumn(const size_t &j, LAP_DoubleVector &v) const
get the j-th column of this symmetric matrix in a vector
Definition: MMSD_DoubleSymmetricMatrix.h:294
void product(const LAP_DoubleVector &vect, LAP_DoubleVector &result) const
return result=this.vector
Definition: MMSD_DoubleSymmetricMatrix.h:368
virtual tReal norm2(LAP_DoubleVector &v) const
return norm2 of the matrix and for each row;
Definition: MMSD_DoubleSymmetricMatrix.h:628
void product(SPC::LAP_DoubleVector vect, SP::LAP_DoubleVector result) const
Definition: MMSD_DoubleSymmetricMatrix.h:391
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_Matrix.h:121
static tBoolean computeEigenValueDecomposition(MMSD_DoubleSymmetricMatrix &A, LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &VR)
compute the eigen values decomposition of A; A is destroyed
Definition: MMSD_DoubleSymmetricMatrix.h:554
Definition: MMSD_DoubleSymmetricMatrix.h:22
MMSD_DoubleSymmetricMatrix & operator*=(const MMSD_DoubleSymmetricMatrix &s)
operator *= : element by element multiplication
Definition: MMSD_DoubleSymmetricMatrix.h:98
size_t getSize(const tFlag &d) const
get the rows number
Definition: MMSD_DoubleSymmetricMatrix.h:314
static const tFlag FULL_STORAGE
to store symmetric matrix in afull storage form
Definition: MMSD_DoubleSymmetricMatrix.h:32
void product(const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: MMSD_DoubleSymmetricMatrix.h:454
Definition: LAP_ConstDoubleVector.h:25
#define tReal
Definition: types.h:18
tBoolean product(const MMSD_DoubleSymmetricMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: MMSD_DoubleSymmetricMatrix.h:420
virtual void add(const size_t &i, const size_t &j, const double &v)
add the value taking into account the view
Definition: MMSD_DoubleSymmetricMatrix.h:345
void setSize(const tLVectorIndex &n)
set the view to [0,n[ by 1 increment if values is too small, re-alocate it
Definition: LAP_Vector.h:360
This class is the base class of all Mixture of Multiple Scaled Distribution package.
Definition: MMSD_Object.h:20
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14
MMSD_DoubleSymmetricMatrix & operator=(const LAP_DoubleFullSymmetricMatrix &s)
init all the matrix to s
Definition: MMSD_DoubleSymmetricMatrix.h:165