C++ main module for mmsd Package  1.0
LAP_DoubleBandedUpperMatrix.h
Go to the documentation of this file.
1 #ifndef LAP_DoubleBandedUpperMatrix_H
2 #define LAP_DoubleBandedUpperMatrix_H
3 
5 
7 
8 #include "LAP_DoubleVector.h"
10 
11 
14 #include "dvector_functions.h"
15 
17 
33 
34  SP_OBJECT(LAP_DoubleBandedUpperMatrix);
35 
36 private:
37  // ATTRIBUTES
38 
39 
40  // ASSOCIATIONS
41  // METHOD
42 
43 
44 public:
45  // CONSTRUCTORS
52 
53  // DESTRUCTORS
57 
58 
59 
60  // -------------
61  // NEW METHODS
62  // -------------
63 public:
64 
65  inline static SP::LAP_DoubleBandedUpperMatrix New() {
66  SP::LAP_DoubleBandedUpperMatrix p(new LAP_DoubleBandedUpperMatrix(),
68  p->setThis(p);
69  return p;
70  };
71 
72  inline static SP::LAP_DoubleBandedUpperMatrix New(const tLVectorIndex& n) {
73  SP::LAP_DoubleBandedUpperMatrix p=New();
74  p->setSize(n);
75  return p;
76  };
79  virtual SP::LAP_DoubleMatrix NewInstance() const {
80  return New();
81  }
82 
83  //-----------
84  // OPERATORS
85  // ----------
88  virtual double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) {
89  return (i<=j)?getBandedStorage()(i,j):getNullValue();
90  };
91 
94  virtual const double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) const {
95  return (i<=j)?getBandedStorage()(i,j):getNullValue();
96  };
97 
98  //copy operators
99  //==============
100 
104  getStorage().init(s);
105  return (*this);
106  };
110  copy(s);
111  return (*this);
112  };
113 
114 
115  //scalar operators
116  //================
117 
121  getBandedStorage()^=s;
122  return (*this);
123  }
124 
128  getBandedStorage()*=s;
129  return (*this);
130  }
134  getBandedStorage()/=s;
135  return (*this);
136  }
137 
141  getBandedStorage()+=s;
142  return (*this);
143  }
144 
145 
149  getBandedStorage()-=s;
150  return (*this);
151  }
154  inline tBoolean compile() {
155  return getBandedStorage().compile();
156  }
157  //pack matrix operator
158  //=====================
159 
164  return (*this);
165  }
170  return (*this);
171  }
172 
177  return (*this);
178  }
183  return (*this);
184  }
185 
186 
187 
188 public:
189  // COPY Methods
190  // ==========
191 
192 
193 
199 
200  //dimension setting
201  //=================
202 
206  virtual void setSize(const tLVectorIndex & nRows,const tLVectorIndex& nCols) {
207  LAP_DoubleUpperMatrix::setSize(nRows,nCols);
209  tLVectorIndex nBandsNumber=s.getBandsNumber();
210  if (nBandsNumber<=0) {
211  if (nRows>=nCols) s.setBandsNumber(nCols,nRows-nCols+1);
212  else s.setBandsNumber(nCols,1);
213  nBandsNumber=s.getBandsNumber();
214  }
215  getStorage().setValuesNumber( ((tLVectorIndex) nCols) * nBandsNumber);
216  }
217 
221  virtual void setSize(const tLVectorIndex & n) {
224  tLVectorIndex nBandsNumber=s.getBandsNumber();
225  if (nBandsNumber<=0) {
226  s.setBandsNumber(n,1);
227  nBandsNumber=s.getBandsNumber();
228  }
229  getStorage().setValuesNumber( ((tLVectorIndex) n) * nBandsNumber);
230  }
231 
234  inline void setBandsNumber(const tLVectorIndex& n) {
236  }
237 
238  // values setting
239  //================
240 
245  virtual void setValues(SP::LAP_DoubleVector values) {
246  ASSERT_IN(values.get()!=null);
247 
248  //compute the numbr of columns
249  tLVectorIndex n=values->getSize();
250  n/=getBandsNumber();
252 
253  //set the values pointer
254  getStorage().setValuesPointer(values);
255 
256  }
259  virtual void setValues(const tLVectorIndex& n,const double* values) {
260  tLVectorIndex nCols=n/getBandsNumber();
261  LAP_DoubleUpperMatrix::setSize(nCols,nCols);
262 
263  //set the values pointer
264  getStorage().setValues(n,values);
265  }
266 
267 
268 
270  //======
271 public:
275  return *dynamic_cast<LAP_DoubleBandedStorage*>(&getStorage());
276  };
280  return *dynamic_cast<const LAP_DoubleBandedStorage*>(&getStorage());
281  };
282 public:
285  inline const tLVectorIndex& getBandsNumber() const {
286  return getBandedStorage().getBandsNumber();
287  }
290  inline const tLVectorIndex& getUpperBandsNumber() const {
292  }
295  virtual void getColumn(const tLVectorIndex& j,LAP_DoubleVector& v) const;
298  virtual void getColumn(const tLVectorIndex& j,SP::LAP_DoubleVector v) const {
299  ASSERT_IN(v.get()!=null);
300  getColumn(j,*v.get());
301  };
302 
305  virtual void getRow(const tLVectorIndex& i,LAP_DoubleVector& v) const;
306 
309  virtual void getRow(const tLVectorIndex& i,SP::LAP_DoubleVector v) const {
310  ASSERT_IN(v.get()!=null);
311  getRow(i,*v.get());
312  };
313 
314 
315 
316  // ------------------------
317  // operation on matrix
318  // ------------------------
319 public:
320 
321 
324  virtual tReal norm2() const;
325 
328  virtual tReal norm2(LAP_DoubleVector& v) const;
329 
330 
331 
332 
338  virtual tReal sum(const tFlag& d,LAP_DoubleVector& s) const;
339 
345  virtual tReal sum(const tFlag& d,const tLVectorIndex& index) const;
346 
352  virtual tReal max(const tFlag& d,const tLVectorIndex& index) const {
353  return getBandedStorage().max(d,index);
354  }
355 
361  getBandedStorage().indexMin(i,j);
362  }
363 
364 
365 
366  // ----------------
367  // vector product
368  // ----------------
369 
370 public:
375  virtual void vectorProduct(const tBoolean& isTrans,LAP_DoubleVector& X) const {
376  vectorProduct(isTrans,1,X);
377  }
378  /* \brief compute X:=alpha.op(This).X
379  * @param isTrans : if (isTrans) op(A)=A else op(A)=tA
380  * @param alpha: alpha value
381  * @param X: X
382  */
383  inline void vectorProduct(const tBoolean& isTrans,const double& alpha,LAP_DoubleVector& X) const {
384  if (alpha==0) X=0;
385  else {
388  if (nRows==nCols) {
389  //X:=op(This).X
390  vectorProduct(isTrans,nRows,X.getIncrement(),&X(0));
391  //X*=alpha
392  if (alpha!=1) X*=alpha;
393  }
394  else {
396  Y.setSize(nRows);
397  vectorProduct(isTrans,
398  X.getSize(),X.getIncrement(),&X(0),
399  alpha,0.,
400  Y.getSize(),Y.getIncrement(),&Y(0));
401  X.copy(Y);
402  }
403  }
404 
405  };
406 
407 
408 
416  void vectorProduct(const tBoolean& isTrans,
417  const LAP_DoubleVector& X,
418  const lapack_real& alpha,
419  const lapack_real& beta,
420  LAP_DoubleVector& Y) const {
421  //get the dimenson of Matrix
424 
425  if (nRows==0) return;
426 
427  if (isTrans) std::swap(nRows,nCols);
428 
429  tLVectorIndex nX=X.getSize();
430 
431  //verify the dimension of X
432  if (nX!=nCols) {
433  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedUpperMatrix::product()","incompatible size of X vector");
434  }
435  //verify the packed upper marix is squared
436  if (nRows!=nCols) {
437  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedUpperMatrix::product()","only squared matrix");
438  }
439 
440  //create the right dimension of return vector Y
441  if (beta==0) {
442  //Y=X
443  Y.copy(X);
444  //Y=op(A).X
445  vectorProduct(isTrans,nRows,Y.getIncrement(),&Y(0));
446  //Y=alpha.op(A).X
447  if (alpha!=1) Y*=alpha;
448  return;
449  }
450 
451  //verify the dimension of Y
452  tLVectorIndex nY=Y.getSize();
453  if (nY!=nRows) {
454  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedUpperMatrix::product()","incompatible size of Y vector");
455  }
456 
457  //test if the lapack mat-vector routine can be called : Y:=alpha.op(A).X
458  vectorProduct(isTrans,
459  nX,X.getIncrement(),&X(0),
460  alpha,
461  beta,
462  nY,Y.getIncrement(),&Y(0));
463  };
464 
472  void vectorProduct(const tBoolean& isTrans,
473  const LAP_ConstDoubleVector& X,
474  const lapack_real& alpha,
475  const lapack_real& beta,
476  LAP_DoubleVector& Y) const {
477  //get the dimenson of Matrix
480  if (isTrans) std::swap(nRows,nCols);
481 
482  tLVectorIndex nX=X.getSize();
483 
484  //verify the dimension of X
485  if (nX!=nCols) {
486  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedUpperMatrix::product()","incompatible size of X vector");
487  }
488 
489  if (beta==0) {
490  Y.setSize(nRows);
491  }
492  tLVectorIndex nY=Y.getSize();
493  if (nY!=nRows) {
494  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedUpperMatrix::product()","incompatible size of Y vector");
495  }
496 
497  vectorProduct(isTrans,
498  nX,X.getIncrement(),&X(0),
499  alpha,
500  beta,
501  nY,Y.getIncrement(),&Y(0));
502  };
503 
504 
505 
506 public:
507 
508 
517  inline void vectorProduct(const tBoolean& isTrans,const tLVectorIndex& nX,const tLVectorIncrement& incX,double* X) const {
518 
521  if (nRows==0) return;
522 
523  if (nRows!=nCols) {
524  throw LAP_Exception("math/linalg/core","LAP_DoubleBandedUpperMatrix::product()",
525  "X=A.X needs to have a squared matrix");
526  }
527  if (nCols!=nX) {
528  throw LAP_Exception("math/linal/core","LAP_DoubleBandedUpperMatrix::product","incompatible size of X vector");
529  }
530 
532  nRows,
534  &(*this)[0],
535  nX,incX,X);
536  }
549  void vectorProduct(const tBoolean& isTrans,
550  const tLVectorIndex& nX,const tLVectorIncrement& incX,const double *x,
551  const double& alpha,const double& beta,
552  const tLVectorIndex& nY,const tLVectorIncrement& incY,double *y) const;
553 
554 
555 public:
556 
557  void rankProduct(const tBoolean& isTransU,
558  const LAP_DoubleVector& Diag,
559  LAP_DoubleVector& X) const {
560  tLVectorIndex nX=X.getSize();
561 
562  if (nX!=getRowsNumber()) {
563  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:rankDProduct","incompatible dimension of vector");
564  }
565  if (nX!=getColumnsNumber()) {
566  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:rankDProduct","incompatible dimension of vector");
567  }
568  if (nX!=Diag.getSize()) {
569  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:rankDProduct","incompatible dimension of vectors");
570  }
572  getRowsNumber(),
574  &(*this)[0],
575  X.getSize(),X.getIncrement(),&X(0));
576 
577  X*=Diag;
578 
580  getRowsNumber(),
582  &(*this)[0],
583  X.getSize(),X.getIncrement(),&X(0));
584  }
585 
590  void rankProduct(const tBoolean& isTransU,
591  LAP_DoubleVector& X) const {
592  tLVectorIndex nX=X.getSize();
593 
594  if (nX!=getRowsNumber()) {
595  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:rankProduct","incompatible dimension of vector");
596  }
597  if (nX!=getColumnsNumber()) {
598  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:rankProduct","incompatible dimension of vector");
599  }
601  getRowsNumber(),
603  &(*this)[0],
604  X.getSize(),X.getIncrement(),&X(0));
606  getRowsNumber(),
608  &(*this)[0],
609  X.getSize(),X.getIncrement(),&X(0));
610 
611  }
612 
613 
614 
615 
616 
617 public:
618 
619 
620  // ----------------
621  // matrix product
622  // ----------------
628  virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix& B) const;
629 
630 
631 
638  LAP_DoubleFullGeneralMatrix& C) const;
639 
640 
641 
642  //product with full matrix
643  //-------------------------
644 
650  LAP_DoubleFullGeneralMatrix& C) const {
651 
652  matrixProduct(true,false,B,1.,C);
653  };
654 
659  void matrixProduct(const tBoolean& isTransB,
661  LAP_DoubleFullGeneralMatrix& C) const {
662 
663  matrixProduct(true,isTransB,B,1.,C);
664  };
665 
672  LAP_DoubleFullGeneralMatrix& C) const;
673 
674 
686  void matrixProduct(const tBoolean& isLeft,
687  const tBoolean& isTrans,
689  const double& alpha,
690  LAP_DoubleFullGeneralMatrix& C) const;
691 
692 
700  virtual void matrixProduct( const tBoolean& isLeft,
701  const tBoolean& isTrans,
702  const double& alpha,
703  LAP_DoubleFullGeneralMatrix& A) const {
704  matrixProduct(isLeft,isTrans,*this,alpha,A);
705  }
706 
707 
708 
709 
718  static void matrixProduct(const tBoolean& isLeft,
719  const tBoolean& isTransA,
721  const lapack_real& alpha,
723 
724 
725 
726 
727  // ----------------------
728  // eigen values & vectors
729  // ------------------------
730 public:
731 
732 
736  LAP_DoubleVector& U) {
737 
738  tLVectorIndex i,nRows=A.getRowsNumber();
739  U.setSize(nRows);
740  double *U_i=&U(0);
741  const tLVectorIndex &nBands=A.getBandedStorage().getBandsNumber();
742  const tLVectorIncrement &incU=U.getIncrement();
743  const double *A_ii=&A(0,0);
744  for (i=0;i<nRows;i++) {
745  *U_i=*A_ii;
746  U_i+=incU;
747  A_ii+=nBands;
748  }
749  return true;
750  }
751 
755  return computeEigenValues(*this,U);
756  };
757 
758 
759 
760 
761 
762  // -----------------------
763  // linear system solver
764  // -----------------------
765 
774  void solve(const tBoolean& isTrans,
775  LAP_DoubleVector& B) const {
776  tLVectorIndex nB=B.getSize();
777  if (nB!=0)
778  solve(isTrans,nB,B.getIncrement(),&B(0));
779  }
780 
791  virtual void solve(const tBoolean& isTrans,
792  const tLVectorIndex& nB,const tLVectorIncrement& incB,double *B) const {
795  if (nRows==0) return;
796  if (nRows!=nB) throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:solve","incompatible dimension of vector");
797  if (nRows!=nCols)
798  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:solve","only be used with squared matrix");
799 
800  DoubleBandedUpperMatrixVectorSolve(isTrans,nRows,getBandedStorage().getBandsNumber(),&(*this)[0],nB,incB,B);
801  }
802 
812  virtual tBoolean solve(const tBoolean& isTrans,
813  LAP_DoubleFullGeneralMatrix& X) const {
814  return solve(isTrans,*this,X);
815  }
816 
826  static tBoolean solve(const tBoolean& isTransA,
829 
830  tLVectorIndex nARows=A.getRowsNumber();
831  tLVectorIndex nBRows=B.getRowsNumber();
832  tLVectorIndex nBCols=B.getColumnsNumber();
834 
835  if (nARows==0) return true;
836 
837  if (nARows!=nBRows)
838  throw LAP_Exception("math/linal/core"," LAP_DoubleBandedUpperMatrix:solve","incompatible size of matrices");
839 
840  return DoubleBandedUpperMatrixSolve(isTransA,nARows,A.getBandsNumber(),&A[0],nBCols,ldb,&B(0,0));
841 
842 
843  }
844 
845 
846 
847 
848 };
849 #endif
virtual void setValues(const tLVectorIndex &n, const double *values)
set the values
Definition: LAP_DoubleBandedUpperMatrix.h:259
virtual tBoolean copyLower(const LAP_DoubleFullGeneralMatrix &f)
copy the transposed of the full matrix
Definition: LAP_DoubleBandedUpperMatrix.cpp:26
virtual void getRow(const tLVectorIndex &i, LAP_DoubleVector &v) const
get the i-th row in a vector
Definition: LAP_DoubleBandedUpperMatrix.cpp:101
virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix &B) const
general return C=(This) . B Create a general full matrix and return it
Definition: LAP_DoubleBandedUpperMatrix.cpp:577
void vectorProduct(const tBoolean &isTrans, const LAP_ConstDoubleVector &X, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleVector &Y) const
return Y=betaY+alpha.op(This).X
Definition: LAP_DoubleBandedUpperMatrix.h:472
const tLVectorIndex & getUpperBandsNumber() const
get upper bands number
Definition: LAP_DoubleBandedUpperMatrix.h:290
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 vectorProduct(const tBoolean &isTrans, const LAP_DoubleVector &X, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleVector &Y) const
return Y=betaY+alpha.op(This).X
Definition: LAP_DoubleBandedUpperMatrix.h:416
tBoolean compile()
compile the banded matrix
Definition: LAP_DoubleBandedUpperMatrix.h:154
void matrixProduct(const tBoolean &isTransB, const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoubleBandedUpperMatrix.h:659
virtual void getColumn(const tLVectorIndex &j, LAP_DoubleVector &v) const
get the j-th column of this matrix in a vector
Definition: LAP_DoubleBandedUpperMatrix.cpp:150
void vectorProduct(const tBoolean &isTrans, const double &alpha, LAP_DoubleVector &X) const
Definition: LAP_DoubleBandedUpperMatrix.h:383
virtual void setValuesPointer(SP::LAP_DoubleVector v)
set the vector values by reference
Definition: LAP_DoubleMatrixStorage.h:132
void rankProduct(const tBoolean &isTransU, const LAP_DoubleVector &Diag, LAP_DoubleVector &X) const
compute product
Definition: LAP_DoubleBandedUpperMatrix.h:557
virtual void vectorProduct(const tBoolean &isTrans, LAP_DoubleVector &X) const
compute X:=op(This).X
Definition: LAP_DoubleBandedUpperMatrix.h:375
LAP_DoubleBandedUpperMatrix & operator/=(const lapack_real &s)
divide by s the matrix v
Definition: LAP_DoubleBandedUpperMatrix.h:133
virtual tBoolean copy(const LAP_DoubleMatrix &x)
copy a matrix
Definition: LAP_DoubleMatrix.cpp:18
double & getNullValue()
get a null value
Definition: LAP_Object.h:54
void setBandsNumber(const tLVectorIndex &n)
set bands number
Definition: LAP_DoubleBandedUpperMatrix.h:234
tBoolean compile()
compile the matrix to optimal bands number
Definition: LAP_DoubleBandedStorage.h:222
void indexMin(tLVectorIndex &i, tLVectorIndex &j) const
get the index of the min view element in absolute value
Definition: LAP_DoubleBandedUpperMatrix.h:360
Definition: LAP_DoubleVector.h:20
double 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_DoubleBandedStorage.cpp:1349
Definition: LAP_DoubleMatrix.h:18
virtual tBoolean solve(const tBoolean &isTrans, LAP_DoubleFullGeneralMatrix &X) const
solve:
Definition: LAP_DoubleBandedUpperMatrix.h:812
this class describes a band upper matrix for lapack used where values are stored in vectorof size nBa...
Definition: LAP_DoubleBandedUpperMatrix.h:32
virtual ~LAP_DoubleBandedUpperMatrix()
destroy a matrix
Definition: LAP_DoubleBandedUpperMatrix.cpp:18
this class describes a banded storage for lapack used where values are stored in vector of size (nSBa...
Definition: LAP_DoubleBandedStorage.h:24
DEFINE_SPTR(LAP_DoubleBandedUpperMatrix)
virtual void getRow(const tLVectorIndex &i, SP::LAP_DoubleVector v) const
get the i-th row in a vector
Definition: LAP_DoubleBandedUpperMatrix.h:309
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
virtual double & operator()(const tLVectorIndex &i, const tLVectorIndex &j)
accessor of element at row i and column j taking into account the row
Definition: LAP_DoubleBandedUpperMatrix.h:88
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_DoubleBandedUpperMatrix.cpp:309
#define tBoolean
Definition: types.h:48
void rankProduct(const tBoolean &isTransU, LAP_DoubleVector &X) const
compute product X:=top(U) op(U) X
Definition: LAP_DoubleBandedUpperMatrix.h:590
static SP::LAP_DoubleBandedUpperMatrix New()
Definition: LAP_DoubleBandedUpperMatrix.h:65
#define lapack_real
Definition: lapack_functions.h:9
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:366
LAP_DoubleBandedUpperMatrix & operator-=(const LAP_DoubleBandedUpperMatrix &s)
sub the viewed matrix
Definition: LAP_DoubleBandedUpperMatrix.h:175
void solve(const tBoolean &isTrans, LAP_DoubleVector &B) const
solve:
Definition: LAP_DoubleBandedUpperMatrix.h:774
const tLVectorIndex & getBandsNumber() const
get the bands number
Definition: LAP_DoubleBandedStorage.h:237
const LAP_DoubleBandedStorage & getBandedStorage() const
get the banded storage
Definition: LAP_DoubleBandedUpperMatrix.h:279
const tLVectorIndex & getUpperBandsNumber() const
get the upper bands number
Definition: LAP_DoubleBandedStorage.h:242
virtual SP::LAP_DoubleMatrix NewInstance() const
create a New instance of this
Definition: LAP_DoubleBandedUpperMatrix.h:79
#define null
Definition: types.h:13
void DoubleBandedUpperMatrixVectorSolve(const tBoolean &isTransA, const tLVectorIndex &nARows, const tLVectorIndex &nABands, const double *A, const tLVectorIndex &nB, const tLVectorIncrement &incB, double *B)
Definition: dbandeduppermatrix_functions.cpp:356
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_Vector.h:529
LAP_DoubleBandedUpperMatrix & operator+=(const LAP_DoubleBandedUpperMatrix &s)
add the viewed matrix
Definition: LAP_DoubleBandedUpperMatrix.h:181
void init(const double &v)
init the values
Definition: LAP_DoubleMatrixStorage.h:124
static tBoolean computeEigenValues(const LAP_DoubleBandedUpperMatrix &A, LAP_DoubleVector &U)
compute the eigen values of A and A is destroyed after method
Definition: LAP_DoubleBandedUpperMatrix.h:735
virtual void setValuesNumber(const tLVectorIndex &n)
set the values number
Definition: LAP_DoubleMatrixStorage.h:155
Definition: LAP_DoubleFullGeneralMatrix.h:30
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_Vector.h:519
const tLVectorIndex & getBandsNumber() const
get bands number
Definition: LAP_DoubleBandedUpperMatrix.h:285
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_DoubleBandedUpperMatrix.h:245
virtual void setSize(const tLVectorIndex &nRows, const tLVectorIndex &nCols)
set the dimension of the matrix
Definition: LAP_DoubleBandedUpperMatrix.h:206
LAP_DoubleBandedUpperMatrix & operator-=(const lapack_real &s)
sub s to the upper matrix
Definition: LAP_DoubleBandedUpperMatrix.h:148
tBoolean DoubleBandedUpperMatrixSolve(const tBoolean &isTransA, const tLVectorIndex &nARows, const tLVectorIndex &nABands, const double *A, const tLVectorIndex &nBCols, const tLVectorIndex &ldB, double *B)
Definition: dbandeduppermatrix_functions.cpp:498
virtual const double & operator()(const tLVectorIndex &i, const tLVectorIndex &j) const
accessor of element at row i and column j
Definition: LAP_DoubleBandedUpperMatrix.h:94
LAP_DoubleBandedUpperMatrix & operator*=(const lapack_real &s)
multiply by s the matrix
Definition: LAP_DoubleBandedUpperMatrix.h:127
LAP_DoubleBandedUpperMatrix()
build a matrix
Definition: LAP_DoubleBandedUpperMatrix.cpp:6
void indexMin(tLVectorIndex &i, tLVectorIndex &j) const
get the index of the min view element in absolute value
Definition: LAP_DoubleBandedStorage.cpp:1261
this class describes a general double symmetric matrix
Definition: LAP_DoubleUpperMatrix.h:17
static tBoolean solve(const tBoolean &isTransA, const LAP_DoubleBandedUpperMatrix &A, LAP_DoubleFullGeneralMatrix &B)
solve:
Definition: LAP_DoubleBandedUpperMatrix.h:826
virtual void setSize(const tLVectorIndex &n)
set the dimension of the matrix
Definition: LAP_DoubleBandedUpperMatrix.h:221
virtual void solve(const tBoolean &isTrans, const tLVectorIndex &nB, const tLVectorIncrement &incB, double *B) const
solve:
Definition: LAP_DoubleBandedUpperMatrix.h:791
LAP_DoubleBandedUpperMatrix & operator^=(const lapack_real &s)
power by s the matrix v
Definition: LAP_DoubleBandedUpperMatrix.h:120
LAP_DoubleBandedUpperMatrix & operator*=(const LAP_DoubleBandedUpperMatrix &s)
multiply the viewed matrices term by term
Definition: LAP_DoubleBandedUpperMatrix.h:162
LAP_DoubleBandedUpperMatrix & operator=(const double &s)
init all the matrix to s
Definition: LAP_DoubleBandedUpperMatrix.h:103
void matrixProduct(const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoubleBandedUpperMatrix.h:649
#define tLVectorIndex
Definition: lapack_types.h:13
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
virtual void getColumn(const tLVectorIndex &j, SP::LAP_DoubleVector v) const
get the j-th column of this matrix in a vector
Definition: LAP_DoubleBandedUpperMatrix.h:298
virtual void matrixProduct(const tBoolean &isLeft, const tBoolean &isTrans, const double &alpha, LAP_DoubleFullGeneralMatrix &A) const
compute A:=alpha op(This).A or A:=alpha A. op(This)
Definition: LAP_DoubleBandedUpperMatrix.h:700
tLVectorIndex getLeadingDimension() const
get the memory distance between (*this)(i,j) & (*this)(i,j+1)
Definition: LAP_DoubleFullGeneralMatrix.h:351
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This
Definition: LAP_DoubleBandedUpperMatrix.h:754
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:371
LAP_DoubleBandedUpperMatrix & operator/=(const LAP_DoubleBandedUpperMatrix &s)
divide the viewed matrices term by term
Definition: LAP_DoubleBandedUpperMatrix.h:168
void vectorProduct(const tBoolean &isTrans, const tLVectorIndex &nX, const tLVectorIncrement &incX, double *X) const
compute X:=op(A). X
Definition: LAP_DoubleBandedUpperMatrix.h:517
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_Matrix.h:121
LAP_DoubleBandedUpperMatrix & operator=(const LAP_DoubleMatrix &s)
init all the matrix to s
Definition: LAP_DoubleBandedUpperMatrix.h:109
virtual tReal max(const tFlag &d, const tLVectorIndex &index) const
make get max among the direction if (d==ROW) max of the elements of row at index if (d==COL) max of t...
Definition: LAP_DoubleBandedUpperMatrix.h:352
#define tLVectorIncrement
Definition: lapack_types.h:16
void copy(const LAP_Vector< lapack_real > &v)
copy the vector v into this. the view is set to [0,v.getSize()[ the viewed values of v is copied into...
Definition: LAP_DoubleVector.h:222
Definition: LAP_ConstDoubleVector.h:25
#define tReal
Definition: types.h:18
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_Matrix.h:116
virtual tReal norm2() const
return norm2 sqrt(sum_ij(aij^2))=sqrt(tr(AtA));
Definition: LAP_DoubleBandedUpperMatrix.cpp:267
static SP::LAP_DoubleBandedUpperMatrix New(const tLVectorIndex &n)
Definition: LAP_DoubleBandedUpperMatrix.h:72
void DoubleBandedUpperMatrixVectorProduct(const tBoolean &isTransA, const tLVectorIndex &nRowsA, const tLVectorIndex &nABands, const double *A, const tLVectorIndex &nX, const tLVectorIncrement &incX, double *x)
Definition: dbandeduppermatrix_functions.cpp:87
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
LAP_DoubleBandedUpperMatrix & operator+=(const lapack_real &s)
add s to the upper matrix
Definition: LAP_DoubleBandedUpperMatrix.h:140
#define ASSERT_IN(a)
Definition: types.h:96
LAP_DoubleBandedStorage & getBandedStorage()
GET.
Definition: LAP_DoubleBandedUpperMatrix.h:274
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14