C++ main module for mmsd Package  1.0
LAP_DoubleBandedSymmetricMatrix.h
Go to the documentation of this file.
1 #ifndef LAP_DoubleBandedSymmetricMatrix_H
2 #define LAP_DoubleBandedSymmetricMatrix_H
3 
6 
9 
10 #include "LAP_DoubleVector.h"
11 #include "LAP_IntegerVector.h"
12 
14 
15 
16 
17 
29 
31 
32 private:
33  // ATTRIBUTES
34 
35 
36  // ASSOCIATIONS
37 
38 
39 
40  // METHOD
41 
42 
43 public:
44  // CONSTRUCTORS
51 
52  // DESTRUCTORS
56 
57 
58 
59  // -------------
60  // NEW METHODS
61  // -------------
62 public:
63 
64  inline static SP::LAP_DoubleBandedSymmetricMatrix New() {
65  SP::LAP_DoubleBandedSymmetricMatrix p(new LAP_DoubleBandedSymmetricMatrix(),
67  p->setThis(p);
68  return p;
69  };
70 
71  inline static SP::LAP_DoubleBandedSymmetricMatrix New(const tLVectorIndex& n) {
72  SP::LAP_DoubleBandedSymmetricMatrix p=New();
73  p->setSize(n);
74  return p;
75  };
78  virtual SP::LAP_DoubleMatrix NewInstance() const {
79  return New();
80  }
81 
82  //-----------
83  // OPERATORS
84  // ----------
85 
89  virtual double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) {
90  return (i<=j)?getBandedStorage()(i,j):getBandedStorage()(j,i);
91  };
92 
96  virtual const double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) const {
97  return (i<=j)?getBandedStorage()(i,j):getBandedStorage()(j,i);
98  };
99 
100 
101 
102 
103  //copy operator
104  //=============
105 
109  getStorage().init(s);
110  return (*this);
111  };
115  copy(s);
116  return (*this);
117  };
118 
119 
120  //scalar operators
121  //================
122 
126  getBandedStorage()^=s;
127  return (*this);
128  }
129 
133  getBandedStorage()*=s;
134  return (*this);
135  }
139  getBandedStorage()/=s;
140  return (*this);
141  }
142 
146  getBandedStorage()+=s;
147  return (*this);
148  }
149 
150 
154  getBandedStorage()-=s;
155  return (*this);
156  }
157 
158  //pack matrix operator
159  //=====================
160 
165  return (*this);
166  }
171  return (*this);
172  }
173 
178  return (*this);
179  }
184  return (*this);
185  }
186 
187 
188  // ----------------
189  // MATRIX SETTINGS
190  // ----------------
191 
192 public:
193 
194 
195 
196  //dimension setting
197  //=================
198 
202  virtual void setSize(const tLVectorIndex & nRows,const tLVectorIndex& nCols) {
205  tLVectorIndex nBandsNumber=s.getBandsNumber();
206  if (nBandsNumber<=0) {
207  if (nRows>=nCols) s.setBandsNumber(nCols,nRows-nCols+1);
208  else s.setBandsNumber(nCols,1);
209  nBandsNumber=s.getBandsNumber();
210  }
211  getStorage().setValuesNumber( ((tLVectorIndex) nCols) * nBandsNumber);
212  }
213 
217  virtual void setSize(const tLVectorIndex & n) {
220  tLVectorIndex nBandsNumber=s.getBandsNumber();
221  if (nBandsNumber<=0) {
222  s.setBandsNumber(n,1);
223  nBandsNumber=s.getBandsNumber();
224  }
225  getStorage().setValuesNumber( ((tLVectorIndex) n) * nBandsNumber);
226  }
227 
230  inline void setBandsNumber(const tLVectorIndex& n) {
232  }
233 
234 
235  //set the values from vectors
236  //===========================
237 
238 
243  virtual void setValues(SP::LAP_DoubleVector values) {
244  ASSERT_IN(values.get()!=null);
245 
246  //compute the numbr of columns
247  tLVectorIndex n=values->getSize();
248  n/=getBandsNumber();
250 
251  //set the values pointer
252  getStorage().setValuesPointer(values);
253 
254  }
257  virtual void setValues(const tLVectorIndex& n,const double* values) {
258  tLVectorIndex nRows=n/getBandsNumber();
260 
261  //set the values pointer
262  getStorage().setValues(n,values);
263  }
264 
267  inline tBoolean compile() {
268  return getBandedStorage().compile();
269  }
270 
272  //======
273 
274 public:
278  return *dynamic_cast<LAP_DoubleBandedStorage*>(&getStorage());
279  };
283  return *dynamic_cast<const LAP_DoubleBandedStorage*>(&getStorage());
284  };
285 public:
288  inline const tLVectorIndex& getBandsNumber() const {
289  return getBandedStorage().getBandsNumber();
290  }
293  inline const tLVectorIndex& getUpperBandsNumber() const {
295  }
296 
299  virtual void getColumn(const tLVectorIndex& j,LAP_DoubleVector& v) const;
302  virtual void getColumn(const tLVectorIndex& j,SP::LAP_DoubleVector v) const {
303  ASSERT_IN(v.get()!=null);
305  };
306 
307 
308 
309 
312  virtual void getRow(const tLVectorIndex& i,LAP_DoubleVector& v) const;
313 
316  virtual void getRow(const tLVectorIndex& i,SP::LAP_DoubleVector v) const {
317  ASSERT_IN(v.get()!=null);
319  };
320 
321 
322 
323  // ------------------------
324  // operation on matrix
325  // ------------------------
326 public:
327 
328 
331  virtual tReal norm2() const;
332 
335  virtual tReal norm2(LAP_DoubleVector& v) const;
336 
337 
338 
344  virtual tReal sum(const tFlag& d,LAP_DoubleVector& s) const;
345 
351  virtual tReal sum(const tFlag& d,const tLVectorIndex& index) const;
352 
353 
354  // Linear methods
355  // ==============
356 
357 
358 
359 
360  // ----------------
361  // vector product
362  // ----------------
363 
364 public:
365 
370  virtual void vectorProduct(const LAP_DoubleVector& X,LAP_DoubleVector& Y) {
372  }
373 
380  virtual void vectorProduct(const LAP_DoubleVector& X,
381  const lapack_real& alpha,
382  const lapack_real& beta,
383  LAP_DoubleVector& Y) const {
384  //get the dimenson of Matrix
386 
387  tLVectorIndex nX=X.getSize();
388 
389  //verify the dimension of X
390  if (nX!=nRows) {
391  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedSymmetricMatrix::product()","incompatible size of X vector");
392  }
393 
394  //set the dimension of Y is beta=0
395  if (beta==0) {
396  Y.setSize(nRows);
397  }
398  tLVectorIndex nY=Y.getSize();
399  if (nY!=nRows) {
400  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedSymmetricMatrix::product()","incompatible size of Y vector");
401  }
402  //make the product
403  vectorProduct(nX,X.getIncrement(),&X(0),
404  alpha,
405  beta,
406  nY,Y.getIncrement(),&Y(0));
407  };
408 
415  virtual void vectorProduct(const LAP_ConstDoubleVector& X,
416  const lapack_real& alpha,
417  const lapack_real& beta,
418  LAP_DoubleVector& Y) const {
419  //get the dimenson of Matrix
421 
422  tLVectorIndex nX=X.getSize();
423 
424  //verify the dimension of X
425  if (nX!=nRows) {
426  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedSymmetricMatrix::product()","incompatible size of X vector");
427  }
428 
429  //set the dimension of Y is beta=0
430  if (beta==0) {
431  Y.setSize(nRows);
432  }
433  tLVectorIndex nY=Y.getSize();
434  if (nY!=nRows) {
435  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedSymmetricMatrix::product()","incompatible size of Y vector");
436  }
437  //make the product
438  vectorProduct(nX,X.getIncrement(),&X(0),
439  alpha,
440  beta,
441  nY,Y.getIncrement(),&Y(0));
442  };
443 
444 
445 public:
456  virtual void vectorProduct(const tBoolean& isTrans,
457  const tLVectorIndex& nX,const tLVectorIncrement& incX,const double *X,
458  const lapack_real& alpha, const lapack_real& beta,
459  const tLVectorIndex& nY,const tLVectorIncrement& incY,double *Y) const {
460  vectorProduct(nX,incX,X,alpha,beta,nY,incY,Y);
461  }
462 
475  virtual void vectorProduct(const tLVectorIndex& nx,const tLVectorIncrement& incx,const double* x,
476  const lapack_real& alpha,
477  const lapack_real& beta,
478  const tLVectorIndex& ny,const tLVectorIncrement&incy,double* y) const {
479 
481  tLVectorIndex nBands=getBandsNumber();
482  if (nRows==0) return;
483  if (nRows!=nx) {
484  throw LAP_Exception("math/linal/core","LAP_DoubleBandedSymmetricMatrix::product","incompatible size of X vector");
485  }
486  if (nRows!=ny) {
487  throw LAP_Exception("math/linal/core","LAP_DoubleBandedSymmetricMatrix::product","incompatible size of Y vector");
488  }
489  if (x==y) {
490  throw LAP_Exception("math/linal/core","LAP_DoubleBandedSymmetricMatrix::product","x & y must have different pointer");
491  }
492 
494  nRows,nBands,
495  &(*this)[0],
496  alpha,beta,
497  ny,incy,y);
498  }
499 
504  A.getRowIncrement(),A.getLeadingDimension(),false,&A(0,0));
505  }
508  inline void rankSymmetricProduct(const double alpha,const tBoolean& isTransA,const LAP_DoubleFullGeneralMatrix& A) {
510  A.getRowIncrement(),A.getLeadingDimension(),isTransA,&A(0,0));
511  }
512 
523  virtual void rankSymmetricProduct(const double& alpha,const double& beta,
524  const tLVectorIndex& nARows,const tLVectorIndex& nACols,const tLVectorIncrement& incA,const tLVectorIndex& ldA,
525  const tBoolean& isTransA,const double* A);
526 
527  // ----------------
528  // matrix product
529  // ----------------
532  virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix& B) const {
533  SP::LAP_DoubleFullGeneralMatrix C=LAP_DoubleFullGeneralMatrix::New();
534 
535  const LAP_DoubleFullGeneralMatrix* dgeM=dynamic_cast<const LAP_DoubleFullGeneralMatrix*>(&B);
536  if (dgeM!=null) {
537  matrixProduct(*dgeM,*C.get());
538  return C;
539  }
540  return C;
541  };
542 
546  LAP_DoubleFullGeneralMatrix& C) const {
547 
549  matrixProduct(true,(*this),B,1.0,0,C);
550  };
551 
552 
557  virtual void matrixProduct(const tBoolean& leftSide,
559  const lapack_real& alpha,
560  const lapack_real& beta,
561  LAP_DoubleFullGeneralMatrix& C) const {
562 
563  matrixProduct(leftSide,*this,B,alpha,beta,C);
564 
565  }
578  virtual void matrixProduct(const tBoolean& leftSide,
579  const tLVectorIndex& nBRows,
580  const tLVectorIndex& nBCols,
581  const tLVectorIncrement& incB,
582  const tLVectorIndex& ldB,
583  const double* B,
584  const lapack_real& alpha,
585  const lapack_real& beta,
586  LAP_DoubleFullGeneralMatrix& C) const {
587  ASSERT_IN(B!=&C(0,0));
588 
589  //verify the dimension
591 
592  tLVectorIndex M=nBRows;
593  tLVectorIndex P=nBCols;
594  if (!leftSide) std::swap(M,P);
595 
596  if (N!=M) throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of matrix");
597  if (beta==0) {
598  if (leftSide) C.setSize(N,P);
599  else C.setSize(P,N);
600  } else {
601  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
602  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
603  }
604 
605  if (nBRows!=nBCols) throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of matrix");
606  if (beta==0) {
607  if (leftSide) C.setSize(N,P);
608  else C.setSize(P,N);
609  } else {
610  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
611  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
612  }
614  getRowsNumber(),getBandsNumber(),&(*this)[0],//S
615  nBRows,nBCols,incB,ldB,B,//B
616  alpha,beta,
618  C.getRowIncrement(),
619  C.getLeadingDimension(),&C(0,0));
620  }
621 
638  static void matrixProduct(const tBoolean& leftSide,
641  const lapack_real& alpha,
642  const lapack_real& beta,
644  ASSERT_IN(&B!=&C);
645 
646  //verify the dimension
650  if (!leftSide) std::swap(M,P);
651 
652  if (N!=M) throw LAP_Exception("math/linalg/core","LAP_DoubleBandedSymmetricMatrix::product()","incompatible size of matrix");
653  if (beta==0) {
654  if (leftSide) C.setSize(N,P);
655  else C.setSize(P,N);
656  } else {
657  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
658  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
659  }
661  S.getRowsNumber(),S.getBandsNumber(),&S[0],//S
663  B.getRowIncrement(),
664  B.getLeadingDimension(),&B(0,0),//B
665  alpha,beta,
667  C.getRowIncrement(),C.getLeadingDimension(),&C(0,0));
668 
669  }
670 
671 
672  // ----------------------
673  // eigen values & vectors
674  // ------------------------
675 public:
680  return computeEigenValues(C,U);
681  };
686  tLVectorIndex nRows=A.getRowsNumber();
688 
689  if (nRows>nCols)
690  throw LAP_Exception("math/linal/core","LAP_DoubleBandedSymmetricMatrix::computeEigenValues","matrix columns number must be greater than its rows number");
691 
692  U.resetView();
693  U.setSize(nRows);
694 
695  return DoubleBandedSymmetricMatrixEigenValues(nRows,A.getBandsNumber(),&A[0],nRows,&U(0),1,null);
696 
697  }
698 
699  public:
704  A.copy(*this);
705  return computeEigenValueDecomposition(A,U,W);
706  };
707 
708 private:
715  LAP_DoubleVector& U,
717  tLVectorIndex nRows=A.getRowsNumber();;
718 
719  U.resetView();
720  U.setSize(nRows);
721  W.setSize(nRows,nRows);
722  return DoubleBandedSymmetricMatrixEigenValues(nRows,A.getBandsNumber(),&A[0],nRows,&U(0),
723  W.getLeadingDimension(),&W(0,0));
724  }
725 
726 
727 
728 
729 public:
736  const int& il,const int& iu) const {
739  return computeEigenValueDecomposition(C,U,VR,Q,il,iu);
740  };
741 
742 
753  LAP_DoubleVector& U,
756  const lapack_int &il,const lapack_int& ul) {
757  tLVectorIndex nRows=A.getRowsNumber();
758 
759  //eigen values
760  int nEigens=ul-il+1;
761  U.resetView();
762  U.setSize(nEigens);
763 
764  //eigen vectors
765  Z.setSize(nRows,nEigens);
766 
767  //orthogonlaisation matrix
768  Q.setSize(nRows,nRows);
769 
771  nEigens,&U(0),
772  il,ul,0,0,
773  Q.getLeadingDimension(),&Q(0,0),
774  Z.getLeadingDimension(),&Z(0,0));
775  }
776 
777 
778 
779 private:
783  static SP::LAP_DoubleBandedUpperMatrix choleskyFactorization(LAP_DoubleBandedSymmetricMatrix& A) {
784 
785  tLVectorIndex nRows=A.getRowsNumber();
787  SP::LAP_DoubleBandedUpperMatrix U=LAP_DoubleBandedUpperMatrix::New();
788  U->setBandsNumber(A.getBandsNumber());
789  SP::LAP_DoubleVector vs;
791  if (succeeds) U->setValues(vs);
792  return U;
793  }
794 public:
795 
799  virtual SP::LAP_DoubleUpperMatrix choleskyFactorization() {
801  }
802 
803 
804 };
805 #endif
virtual tReal norm2() const
return norm2 sqrt(sum_ij(aij^2))=sqrt(tr(AtA));
Definition: LAP_DoubleBandedSymmetricMatrix.cpp:203
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_DoubleBandedSymmetricMatrix.h:702
this class describes the exceptions raised for LAP package
Definition: LAP_Exception.h:14
LAP_DoubleMatrixStorage & getStorage()
set the storage
Definition: LAP_DoubleMatrix.h:179
void setBandsNumber(const tLVectorIndex &n)
set bands number
Definition: LAP_DoubleBandedSymmetricMatrix.h:230
static SP::LAP_DoubleFullGeneralMatrix New()
Definition: LAP_DoubleFullGeneralMatrix.h:78
tBoolean DoubleBandedSymmetricMatrixEigenValues(const tLVectorIndex &nRowsA, const tLVectorIndex &nBandsA, double *A, const tLVectorIndex &nU, double *U, const tLVectorIndex &ldW, double *W)
compute all the eigen values or vectors (if W is not null or ldW<=1)
Definition: dbandedsymmatrix_functions.cpp:375
double get(const tLVectorIndex &i, const tLVectorIndex &j) const
get the value taking into account the view
Definition: LAP_DoubleMatrix.h:172
virtual SP::LAP_DoubleUpperMatrix choleskyFactorization()
compute the choleskey factorization of the full symmetric matrix A is modified such that the upper ma...
Definition: LAP_DoubleBandedSymmetricMatrix.h:799
this class describes a general double symmetric matrix
Definition: LAP_DoubleSymmetricMatrix.h:21
tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &VR, const int &il, const int &iu) const
compute the eigen elements in ascending order of This supposed to be symmetric, the eigen vectors are...
Definition: LAP_DoubleBandedSymmetricMatrix.h:734
virtual void vectorProduct(const tBoolean &isTrans, const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *X, const lapack_real &alpha, const lapack_real &beta, const tLVectorIndex &nY, const tLVectorIncrement &incY, double *Y) const
compute Y= op(This). X with op(A)=A or tA depending on isTrans value
Definition: LAP_DoubleBandedSymmetricMatrix.h:456
tLVectorIncrement getRowIncrement() const
get the memory distance between (*this)(i,j) & (*this)(i+1,j)
Definition: LAP_DoubleFullGeneralMatrix.h:346
virtual void setValuesPointer(SP::LAP_DoubleVector v)
set the vector values by reference
Definition: LAP_DoubleMatrixStorage.h:132
virtual double & operator()(const tLVectorIndex &i, const tLVectorIndex &j)
accessor of element at row i and column j taking into account the view only use the upper diagonal ...
Definition: LAP_DoubleBandedSymmetricMatrix.h:89
virtual void setSize(const tLVectorIndex &n)
set the dimension of the matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:217
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This: A is copied in ascending order
Definition: LAP_DoubleBandedSymmetricMatrix.h:678
virtual tBoolean copy(const LAP_DoubleMatrix &x)
copy a matrix
Definition: LAP_DoubleMatrix.cpp:18
tBoolean compile()
compile the banded matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:267
LAP_DoubleBandedSymmetricMatrix & operator-=(const lapack_real &s)
sub s to the upper matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:153
tBoolean compile()
compile the matrix to optimal bands number
Definition: LAP_DoubleBandedStorage.h:222
LAP_DoubleBandedSymmetricMatrix & operator+=(const LAP_DoubleBandedSymmetricMatrix &s)
add the viewed matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:182
Definition: LAP_DoubleVector.h:20
#define lapack_int
Definition: lapack_functions.h:7
tBoolean DoubleBandedSymmetricMatrixBoundedEigenValues(const tLVectorIndex &nRowsA, const tLVectorIndex &nBandsA, double *A, const tLVectorIndex &nU, double *U, const tLVectorIndex &minIndex, const tLVectorIndex &maxIndex, const double &minBound, const double &maxBound, const tLVectorIndex &ldQ, double *Q, const tLVectorIndex &ldW, double *W)
compute the selected eigen values or vectors (if W is not null or ldW<=1) with
Definition: dbandedsymmatrix_functions.cpp:491
Definition: LAP_DoubleMatrix.h:18
void DoubleBandedSymmetricMatrixVectorProduct(const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *x, const tLVectorIndex &nRows, const tLVectorIndex &nBands, const double *A, const lapack_real &alpha, const lapack_real &beta, const tLVectorIndex &nY, const tLVectorIncrement &incY, double *y)
compute Y:=Beta.Y+alpha A.X
Definition: dbandedsymmatrix_functions.cpp:108
this class describes a banded storage for lapack used where values are stored in vector of size (nSBa...
Definition: LAP_DoubleBandedStorage.h:24
LAP_DoubleBandedSymmetricMatrix & operator-=(const LAP_DoubleBandedSymmetricMatrix &s)
sub the viewed matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:176
const LAP_DoubleBandedStorage & getBandedStorage() const
get the banded storage
Definition: LAP_DoubleBandedSymmetricMatrix.h:282
virtual void getColumn(const tLVectorIndex &j, SP::LAP_DoubleVector v) const
get the j-th column of this symmetric matrix in a vector
Definition: LAP_DoubleBandedSymmetricMatrix.h:302
static tBoolean computeEigenValueDecomposition(LAP_DoubleBandedSymmetricMatrix &A, LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &Z, LAP_DoubleFullGeneralMatrix &Q, const lapack_int &il, const lapack_int &ul)
compute the eigen elements of A in ascending order . A is supposed to be symmetric, the eigen vectors are set in Z, A must be symmetric. only the eigen values & vectors are computed in index il and iu when the iegen values are ordering in an ascent order.
Definition: LAP_DoubleBandedSymmetricMatrix.h:752
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix n x p
Definition: LAP_Matrix.h:87
const tLVectorIndex & setBandsNumber(const tLVectorIndex &u, const tLVectorIndex &l)
set bands number
Definition: LAP_DoubleBandedStorage.h:209
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_ConstVector.h:170
const tLVectorIndex & getBandsNumber() const
get bands number
Definition: LAP_DoubleBandedSymmetricMatrix.h:288
#define tBoolean
Definition: types.h:48
static void matrixProduct(const tBoolean &leftSide, const LAP_DoubleBandedSymmetricMatrix &S, const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C)
compute :
Definition: LAP_DoubleBandedSymmetricMatrix.h:638
virtual const double & operator()(const tLVectorIndex &i, const tLVectorIndex &j) const
accessor of element at row i and column j taking into account the view only use the upper diagonal ...
Definition: LAP_DoubleBandedSymmetricMatrix.h:96
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
static SP::LAP_DoubleBandedUpperMatrix New()
Definition: LAP_DoubleBandedUpperMatrix.h:65
virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix &B) const
return C=(This) . B
Definition: LAP_DoubleBandedSymmetricMatrix.h:532
#define lapack_real
Definition: lapack_functions.h:9
LAP_DoubleBandedSymmetricMatrix & operator/=(const lapack_real &s)
divide by s the matrix v
Definition: LAP_DoubleBandedSymmetricMatrix.h:138
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:366
virtual void matrixProduct(const tBoolean &leftSide, const tLVectorIndex &nBRows, const tLVectorIndex &nBCols, const tLVectorIncrement &incB, const tLVectorIndex &ldB, const double *B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C) const
make the product:
Definition: LAP_DoubleBandedSymmetricMatrix.h:578
const tLVectorIndex & getBandsNumber() const
get the bands number
Definition: LAP_DoubleBandedStorage.h:237
const tLVectorIndex & getUpperBandsNumber() const
get the upper bands number
Definition: LAP_DoubleBandedStorage.h:242
#define null
Definition: types.h:13
this class describes a packed symmetric matrix for lapack used where values are stored in vector: {A(...
Definition: LAP_DoubleBandedSymmetricMatrix.h:28
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_Vector.h:529
LAP_DoubleBandedStorage & getBandedStorage()
GET.
Definition: LAP_DoubleBandedSymmetricMatrix.h:277
void init(const double &v)
init the values
Definition: LAP_DoubleMatrixStorage.h:124
const tLVectorIndex & getUpperBandsNumber() const
get upper bands number
Definition: LAP_DoubleBandedSymmetricMatrix.h:293
virtual void setValuesNumber(const tLVectorIndex &n)
set the values number
Definition: LAP_DoubleMatrixStorage.h:155
void rankSymmetricProduct(const double alpha, const tBoolean &isTransA, const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix This:=alpha. op(A).t(op(A))
Definition: LAP_DoubleBandedSymmetricMatrix.h:508
Definition: LAP_DoubleFullGeneralMatrix.h:30
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_Vector.h:519
virtual void getValuesPointer(SP::LAP_DoubleVector &v)
Definition: LAP_DoubleMatrixStorage.h:208
LAP_DoubleBandedSymmetricMatrix()
build a matrix
Definition: LAP_DoubleBandedSymmetricMatrix.cpp:15
LAP_DoubleBandedSymmetricMatrix & operator*=(const LAP_DoubleBandedSymmetricMatrix &s)
multiply the viewed matrices term by term
Definition: LAP_DoubleBandedSymmetricMatrix.h:163
virtual void setValues(const tLVectorIndex &n, const double *values)
set the values
Definition: LAP_DoubleBandedSymmetricMatrix.h:257
LAP_DoubleBandedSymmetricMatrix & operator+=(const lapack_real &s)
add s to the upper matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:145
virtual void setSize(const tLVectorIndex &nRows, const tLVectorIndex &nCols)
set the dimension of the matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:202
tBoolean DoubleBandedSymmetricMatrixCholeskyFactorization(const tLVectorIndex &nRows, const tLVectorIndex &nBands, double *A)
make the cholesky factorization A=tU.U
Definition: dbandedsymmatrix_functions.cpp:707
static SP::LAP_DoubleBandedSymmetricMatrix New()
Definition: LAP_DoubleBandedSymmetricMatrix.h:64
LAP_DoubleBandedSymmetricMatrix & operator*=(const lapack_real &s)
multiply by s the matrix
Definition: LAP_DoubleBandedSymmetricMatrix.h:132
virtual void vectorProduct(const LAP_DoubleVector &X, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleVector &Y) const
compute Y:=betaY+alpha.This.X
Definition: LAP_DoubleBandedSymmetricMatrix.h:380
#define tLVectorIndex
Definition: lapack_types.h:13
DEFINE_SPTR(LAP_DoubleBandedSymmetricMatrix)
LAP_DoubleBandedSymmetricMatrix & operator=(const LAP_DoubleMatrix &s)
init all the matrix to s
Definition: LAP_DoubleBandedSymmetricMatrix.h:114
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
virtual SP::LAP_DoubleMatrix NewInstance() const
create a New instance of this
Definition: LAP_DoubleBandedSymmetricMatrix.h:78
tLVectorIndex getLeadingDimension() const
get the memory distance between (*this)(i,j) & (*this)(i,j+1)
Definition: LAP_DoubleFullGeneralMatrix.h:351
virtual void vectorProduct(const LAP_DoubleVector &X, LAP_DoubleVector &Y)
compute Y=A.X
Definition: LAP_DoubleBandedSymmetricMatrix.h:370
void matrixProduct(const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoubleBandedSymmetricMatrix.h:545
virtual void getRow(const tLVectorIndex &i, LAP_DoubleVector &v) const
get the i-th row in a vector
Definition: LAP_DoubleBandedSymmetricMatrix.cpp:36
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:371
virtual void vectorProduct(const LAP_ConstDoubleVector &X, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleVector &Y) const
compute Y:=betaY+alpha.This.X
Definition: LAP_DoubleBandedSymmetricMatrix.h:415
virtual void getRow(const tLVectorIndex &i, SP::LAP_DoubleVector v) const
get the i-th row in a vector
Definition: LAP_DoubleBandedSymmetricMatrix.h:316
void rankSymmetricProduct(const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix This:=A. tA
Definition: LAP_DoubleBandedSymmetricMatrix.h:502
void DoubleBandedSymmetricMatrixMatrixProduct(const tBoolean &isLeftSide, const tLVectorIndex &nSRows, const tLVectorIndex &nSBands, const double *S, const tLVectorIndex &nBRows, const tLVectorIndex &nBCols, const tLVectorIncrement &incB, const tLVectorIndex &ldB, const double *B, const lapack_real &alpha, const lapack_real &beta, const tLVectorIndex &nCRows, const tLVectorIndex &nCCols, const tLVectorIncrement &incC, const tLVectorIndex &ldC, double *C)
Definition: dbandedsymmatrix_functions.cpp:256
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_Matrix.h:121
virtual void vectorProduct(const tLVectorIndex &nx, const tLVectorIncrement &incx, const double *x, const lapack_real &alpha, const lapack_real &beta, const tLVectorIndex &ny, const tLVectorIncrement &incy, double *y) const
compute Y= betaY + alpha. This. X
Definition: LAP_DoubleBandedSymmetricMatrix.h:475
#define tLVectorIncrement
Definition: lapack_types.h:16
virtual void getColumn(const tLVectorIndex &j, LAP_DoubleVector &v) const
get the j-th column of this symmetric matrix in a vector
Definition: LAP_DoubleBandedSymmetricMatrix.cpp:102
virtual void matrixProduct(const tBoolean &leftSide, const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C) const
make the product if (leftSide) C = alpha. This . B +beta C if (!leftSide) C = alpha. B . This +beta C
Definition: LAP_DoubleBandedSymmetricMatrix.h:557
virtual void setValues(SP::LAP_DoubleVector values)
set the values set the pointer values of the matrix to values the size of the vector is mBandsNumber*...
Definition: LAP_DoubleBandedSymmetricMatrix.h:243
LAP_DoubleBandedSymmetricMatrix & operator=(const double &s)
init all the matrix to s
Definition: LAP_DoubleBandedSymmetricMatrix.h:108
Definition: LAP_ConstDoubleVector.h:25
virtual ~LAP_DoubleBandedSymmetricMatrix()
destroy a matrix
Definition: LAP_DoubleBandedSymmetricMatrix.cpp:27
#define tReal
Definition: types.h:18
virtual tReal sum(const tFlag &d, LAP_DoubleVector &s) const
make the sum among the direction if (d==ROW) sum all the columns of each row and size of s is the num...
Definition: LAP_DoubleBandedSymmetricMatrix.cpp:255
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_Matrix.h:116
LAP_DoubleBandedSymmetricMatrix & operator^=(const lapack_real &s)
power by s the matrix v
Definition: LAP_DoubleBandedSymmetricMatrix.h:125
virtual SP::LAP_DoubleVector vectorProduct(const LAP_DoubleVector &X) const
compute This. X
Definition: LAP_DoubleMatrix.h:328
LAP_DoubleBandedSymmetricMatrix & operator/=(const LAP_DoubleBandedSymmetricMatrix &s)
divide the viewed matrices term by term
Definition: LAP_DoubleBandedSymmetricMatrix.h:169
void resetView()
set the view of the vector to all the values
Definition: LAP_Vector.h:352
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
virtual void setValues(const tLVectorIndex &n, const double *values)
copy the values
Definition: LAP_DoubleMatrixStorage.h:145
static tBoolean computeEigenValues(LAP_DoubleBandedSymmetricMatrix &A, LAP_DoubleVector &U)
compute the eigen values of A in ascending order and A is destroyed after method lapack method dsyev ...
Definition: LAP_DoubleBandedSymmetricMatrix.h:685
#define ASSERT_IN(a)
Definition: types.h:96
static SP::LAP_DoubleBandedSymmetricMatrix New(const tLVectorIndex &n)
Definition: LAP_DoubleBandedSymmetricMatrix.h:71
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14