C++ main module for mmsd Package  1.0
LAP_DoubleFullUpperMatrix.h
Go to the documentation of this file.
1 #ifndef LAP_DoubleFullUpperMatrix_H
2 #define LAP_DoubleFullUpperMatrix_H
3 
4 //inheritance classes
6 
7 //vector classes
8 #include "LAP_DoubleVector.h"
9 
10 //association classes
11 #include "LAP_DoubleFullStorage.h"
12 
13 //c_lapack routines
15 #include "dvector_functions.h"
16 
17 //friend classes
19 
20 
30 
31  SP_OBJECT(LAP_DoubleFullUpperMatrix);
32 
33 private:
34  // ATTRIBUTES
35 
36 
37  // ASSOCIATIONS
38 
39  // METHOD
40 
41 
42 public:
43  // CONSTRUCTORS
50 
51  // DESTRUCTORS
55 
56 
57 
58  // -------------
59  // NEW METHODS
60  // -------------
61 public:
62 
63  inline static SP::LAP_DoubleFullUpperMatrix New() {
64  SP::LAP_DoubleFullUpperMatrix p(new LAP_DoubleFullUpperMatrix(),
66  p->setThis(p);
67  return p;
68  };
69 
70  inline static SP::LAP_DoubleFullUpperMatrix New(const tLVectorIndex& n) {
71  SP::LAP_DoubleFullUpperMatrix p=New();
72  p->setSize(n);
73  return p;
74  };
77  inline static SP::LAP_DoubleFullUpperMatrix Identity(const tLVectorIndex& nRows) {
78  SP::LAP_DoubleFullUpperMatrix p=New(nRows);
79 
80  double *vs=&(*p.get())[0];
81  for (tLVectorIndex i=0;i<nRows-1;i++) {
82  *vs=1;
83  vs+=nRows+1;
84 
85  }
86  *vs=1;
87  return p;
88  }
89 
92  virtual SP::LAP_DoubleMatrix NewInstance() const {
93  return New();
94  }
95 
96  //-----------
97  // OPERATORS
98  // ----------
99 
103  virtual double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) {
104  return (j<i)? getNullValue():getFullStorage()(i,j);
105  };
106 
110  virtual const double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) const {
111  return (j<i)? getNullValue():getFullStorage()(i,j);
112  };
113 
114 
115 
116  //copy operator
117  //=============
118 
122  getStorage().init(s);
123  resetLowerSubMatrix();
124  return (*this);
125  };
129  copy(s);
130  return (*this);
131  };
132 
133 
134  //scalar operators
135  //================
136 
140  getFullStorage()^=s;
141  return (*this);
142  }
143 
147  getFullStorage()*=s;
148  return (*this);
149  }
153  getFullStorage()/=s;
154  return (*this);
155  }
156 
160  getFullStorage()+=s;
161  return (*this);
162  }
163 
164 
168  getFullStorage()-=s;
169  return (*this);
170  }
171 
172  //pack matrix operator
173  //=====================
174 
178  getFullStorage()*=s.getFullStorage();
179  return (*this);
180  }
184  getFullStorage()/=s.getFullStorage();
185  return (*this);
186  }
187 
191  getFullStorage()-=s.getFullStorage();
192  return (*this);
193  }
197  getFullStorage()+=s.getFullStorage();
198  return (*this);
199  }
200 
201  // ----------------
202  // MATRIX SETTINGS
203  // ----------------
204 private:
207  void resetLowerSubMatrix();
208 
209 
210 public:
216 
217 
218  //set the values from vectors
219  //===========================
220 
224  virtual void setSize(const tLVectorIndex& n,const tLVectorIndex& p) {
225 
226 
227  //set the number of the matrix
229 
230  //set the storage
231  getFullStorage().setValuesNumber(n,n*p);
232 
233  }
237  virtual void setSize(const tLVectorIndex & n) {
238  setSize(n,n);
239  }
246  virtual void setValues(const tLVectorIndex& n,
247  const tLVectorIndex& p,
248  SP::LAP_DoubleVector v) {
249 
250 
251  tLVectorIndex m=v->getSize();
252  if (n*p!=m)
254  else
256 
257  //set the vector values
258  getFullStorage().setValuesPointer(n,v);
259  };
265  virtual void setValues(SP::LAP_DoubleVector v) {
266 
267  tLVectorIndex m=v->getSize();
268  tLVectorIndex nRows=(sqrt(m)+0.5);
269  LAP_DoubleUpperMatrix::setSize(nRows,nRows);
270 
271  //set the vector values
272  getFullStorage().setValuesPointer(nRows,v);
273  };
280  virtual void setValues(const tLVectorIndex& n,
281  const tLVectorIndex& p,
282  const double* values) {
283  //set the size
284  setSize(n,p);
285 
286  //set the storage
287  getFullStorage().setValues(n,n*p,values);
288  }
293  virtual void setValues(const tLVectorIndex& n,
294  const double* values) {
295 
296  tLVectorIndex nRows=(tLVectorIndex) (sqrt(n)+0.5);
297  LAP_DoubleUpperMatrix::setSize(nRows,nRows);
298  //set the storage
299  getFullStorage().setValues(nRows,n,values);
300  }
301 
302 
304  //======
305 private:
308  inline LAP_DoubleFullStorage& getFullStorage() {
309  return *dynamic_cast<LAP_DoubleFullStorage*>(&getStorage());
310  };
313  inline const LAP_DoubleFullStorage& getFullStorage() const {
314  return *dynamic_cast<const LAP_DoubleFullStorage*>(&getStorage());
315  };
316 
317 public:
321  return getFullStorage().getRowIncrement();
322  }
326  return getFullStorage().getLeadingDimension();
327  }
330  virtual tLVectorIndex getRowsNumber() const {
331  return getFullStorage().getViewedRowsNumber();
332  };
335  virtual tLVectorIndex getColumnsNumber() const {
336  return getFullStorage().getViewedColumnsNumber();
337  };
340  virtual void getColumn(const tLVectorIndex& j,LAP_DoubleVector& v) const;
343  virtual void getColumn(const tLVectorIndex& j,SP::LAP_DoubleVector v) const {
344  ASSERT_IN(v.get()!=null);
345  getColumn(j,*v.get());
346  };
347 
348 
349 
350 
353  virtual void getRow(const tLVectorIndex& i,LAP_DoubleVector& v) const;
354 
357  virtual void getRow(const tLVectorIndex& i,SP::LAP_DoubleVector v) const {
358  ASSERT_IN(v.get()!=null);
359  getRow(i,*v.get());
360  };
361 
362 
363 
364 
365 
366  // ------------------------
367  // operation on matrix
368  // ------------------------
369 public:
370 
371 
374  virtual tReal norm2() const;
375 
378  virtual tReal norm2(LAP_DoubleVector& v) const;
379 
380 
381 
382 
388  virtual tReal sum(const tFlag& d,LAP_DoubleVector& s) const;
389 
395  virtual tReal sum(const tFlag& d,const tLVectorIndex& index) const;
396 
402  virtual tReal max(const tFlag& d,const tLVectorIndex& index) const;
403 
408  void indexMin(tLVectorIndex& i,tLVectorIndex& j) const;
409 
410 
411 
412  // ----------------
413  // vector product
414  // ----------------
415 
416 public:
421  virtual void vectorProduct(const LAP_DoubleVector& X,LAP_DoubleVector& Y) const {
422  vectorProduct(false,X,1.,0.,Y);
423  }
429  virtual void vectorProduct(const tBoolean& isTrans,const LAP_DoubleVector& X,LAP_DoubleVector& Y) const {
430  vectorProduct(isTrans,X,1.,0.,Y);
431  }
439  void vectorProduct(const tBoolean& isTrans,
440  const LAP_DoubleVector& X,
441  const lapack_real& alpha,
442  const lapack_real& beta,
443  LAP_DoubleVector& Y) const {
444  //get the dimenson of Matrix
447  if (isTrans) std::swap(nRows,nCols);
448 
449  tLVectorIndex nX=X.getSize();
450 
451  //verify the dimension of X
452  if (nX!=nCols) {
453  throw LAP_Exception("math/linalg/core","LAP_DoubleFullUpperMatrix::product()","incompatible size of X vector");
454  }
455 
456  if (beta==0) {
457  Y.setSize(nRows);
458  }
459  tLVectorIndex nY=Y.getSize();
460  if (nY!=nRows) {
461  throw LAP_Exception("math/linalg/core","LAP_DoubleFullUpperMatrix::product()","incompatible size of Y vector");
462  }
463 
464  vectorProduct(isTrans,
465  nX,X.getIncrement(),&X(0),
466  alpha,
467  beta,
468  nY,Y.getIncrement(),&Y(0));
469  };
470 
478  void vectorProduct(const tBoolean& isTrans,
479  const LAP_ConstDoubleVector& X,
480  const lapack_real& alpha,
481  const lapack_real& beta,
482  LAP_DoubleVector& Y) const {
483  //get the dimenson of Matrix
486  if (isTrans) std::swap(nRows,nCols);
487 
488  tLVectorIndex nX=X.getSize();
489 
490  //verify the dimension of X
491  if (nX!=nCols) {
492  throw LAP_Exception("math/linalg/core","LAP_DoubleFullUpperMatrix::product()","incompatible size of X vector");
493  }
494 
495  if (beta==0) {
496  Y.setSize(nRows);
497  }
498  tLVectorIndex nY=Y.getSize();
499  if (nY!=nRows) {
500  throw LAP_Exception("math/linalg/core","LAP_DoubleFullUpperMatrix::product()","incompatible size of Y vector");
501  }
502 
503  vectorProduct(isTrans,
504  nX,X.getIncrement(),&X(0),
505  alpha,
506  beta,
507  nY,Y.getIncrement(),&Y(0));
508  };
513  virtual void vectorProduct(const tBoolean& isTrans,LAP_DoubleVector& X) const {
514  vectorProduct(isTrans,1,X);
515  }
516  /* \brief compute X:=alpha.op(This).X
517  * @param isTrans : if (isTrans) op(A)=A else op(A)=tA
518  * @param alpha: alpha value
519  * @param X: X
520  */
521  inline void vectorProduct(const tBoolean& isTrans,const double& alpha,LAP_DoubleVector& X) const {
522  if (alpha==0) X=0;
523  else {
526  if (nRows==nCols) {
527  //X:=op(This).X
528  vectorProduct(isTrans,nRows,X.getIncrement(),&X(0));
529  //X*=alpha
530  if (alpha!=1) X*=alpha;
531  }
532  else {
534  Y.setSize(nRows);
535  vectorProduct(isTrans,
536  X.getSize(),X.getIncrement(),&X(0),
537  alpha,0.,
538  Y.getSize(),Y.getIncrement(),&Y(0));
539  X.copy(Y);
540  }
541  }
542 
543  };
544 
545 
546 
547 
548 public:
549 
558  inline void vectorProduct(const tBoolean& isTrans,const tLVectorIndex& nX,const tLVectorIncrement& incX,double* X) const {
559  if (getRowIncrement()!=1) {
560  cout <<"WARNING:row increment matrix ignored in lapack functions. It is set to 1. \n";
561  }
564  if (nRows==0) return;
565 
566  if (nRows!=nCols) {
567  throw LAP_Exception("math/linalg/core","LAP_DoubleFullUpperMatrix::product()",
568  "X=A.X needs to have a squared matrix");
569  }
570  if (nCols!=nX) {
571  throw LAP_Exception("math/linal/core","LAP_DoubleFullUpperMatrix::product","incompatible size of X vector");
572  }
573 
575  nRows,
577  &(*this)(0,0),
578  nX,incX,X);
579 
580  }
593  void vectorProduct(const tBoolean& isTrans,
594  const tLVectorIndex& nX,const tLVectorIncrement& incX,const double *x,
595  const double& alpha,const double& beta,
596  const tLVectorIndex& nY,const tLVectorIncrement& incY,double *y) const;
597 
598 
599 public:
600 
606  virtual void rankProduct(const tBoolean& isTransU,
607  const LAP_DoubleVector& Diag,
608  LAP_DoubleVector& X) const {
609 
610 
611  tLVectorIndex nX=X.getSize();
612  if (getRowIncrement()!=1) {
613  cout <<"WARNING:row increment matrix ignored in lapack functions. It is set to 1. \n";
614  }
615  if (nX!=getRowsNumber()) {
616  throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:rankDProduct","incompatible dimension of vector");
617  }
618  if (nX!=getColumnsNumber()) {
619  throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:rankDProduct","incompatible dimension of vector");
620  }
621  if (nX!=Diag.getSize()) {
622  throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:rankDProduct","incompatible dimension of vectors");
623  }
625  getRowsNumber(),
627  &(*this)(0,0),
628  X.getSize(),X.getIncrement(),&X(0));
629 
630  X*=Diag;
631 
633  getRowsNumber(),
635  &(*this)(0,0),
636  X.getSize(),X.getIncrement(),&X(0));
637  }
638 
643  virtual void rankProduct(const tBoolean& isTransU,LAP_DoubleVector& X) const{
644 
645  tLVectorIndex nX=X.getSize();
646 
647  if (getRowIncrement()!=1) {
648  cout <<"WARNING:row increment matrix ignored in lapack functions. It is set to 1. \n";
649  }
650  if (nX!=getRowsNumber()) {
651  throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:rankProduct","incompatible dimension of vector");
652  }
653  if (nX!=getColumnsNumber()) {
654  throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:rankProduct","incompatible dimension of vector");
655  }
657  getRowsNumber(),
659  &(*this)(0,0),
660  X.getSize(),X.getIncrement(),&X(0));
662  getRowsNumber(),
664  &(*this)(0,0),
665  X.getSize(),X.getIncrement(),&X(0));
666 
667  }
668 
669 
670 
671 
672 
673 public:
674 
675 
676  // ----------------
677  // matrix product
678  // ----------------
683  virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix& B) const;
684 
685 
686  // ----------------
693  LAP_DoubleFullGeneralMatrix& C) const;
694 
695 
696 
697  //product with full matrix
698  //-------------------------
699 
705  LAP_DoubleFullGeneralMatrix& C) const {
706 
707  matrixProduct(false,false,B,1.,C);
708  };
709 
716  LAP_DoubleFullGeneralMatrix& C) const;
717 
718 
730  void matrixProduct(const tBoolean& isLeft,
731  const tBoolean& isTrans,
733  const double& alpha,
734  LAP_DoubleFullGeneralMatrix& C) const;
735 
736 
744  virtual void matrixProduct(const tBoolean& isLeft,
745  const tBoolean& isTrans,
746  const double& alpha,
747  LAP_DoubleFullGeneralMatrix& A) const {
748  matrixProduct(isLeft,isTrans,*this,alpha,A);
749  }
757  virtual void matrixProduct(const tBoolean& isTrans,
758  const double& alpha,
759  LAP_DoubleFullGeneralMatrix& A) const {
760  matrixProduct(true,isTrans,*this,alpha,A);
761  }
762 
763 
764 
765 
774  static void matrixProduct(const tBoolean& isLeft,
775  const tBoolean& isTransA,
776  const LAP_DoubleFullUpperMatrix& A,
777  const lapack_real& alpha,
779 
780 
781 
782 
783  // ----------------------
784  // eigen values & vectors
785  // ------------------------
786 public:
787 
788 
792  LAP_DoubleVector& U) {
794  const tLVectorIncrement &incA=A.getRowIncrement();
795  tLVectorIndex ldd=incA+A.getLeadingDimension();
796 
797  U.setSize(n);
798  double *U_i=&U(0);
799  const tLVectorIncrement &incU=U.getIncrement();
800  const double *A_ii=&A(0,0);
801  for (i=0;i<n;i++) {
802  *U_i=*A_ii;
803  U_i+=incU;
804  A_ii+=ldd;
805  }
806  return true;
807  }
808 
812  return computeEigenValues(*this,U);
813  };
814 
820 
821 
833 
834 
838  LAP_DoubleVector& U,
840 
844  LAP_DoubleVector& U,
847 
848 
849 
850 
851  // -----------------------
852  // linear system solver
853  // -----------------------
862  void solve(const tBoolean& isTrans,
863  LAP_DoubleVector& B) const {
864  tLVectorIndex nB=B.getSize();
865  if (nB!=0)
866  solve(isTrans,nB,B.getIncrement(),&B(0));
867  }
868 
879  virtual void solve(const tBoolean& isTrans,
880  const tLVectorIndex& nB,const tLVectorIncrement& incB,double *B) const {
883  if (nRows==0) return;
884  if (nRows!=nB) throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:solve","incompatible dimension of vector");
885  if (nRows!=nCols)
886  throw LAP_Exception("math/linal/core"," LAP_DoubleFullUpperMatrix:solve","only be used with squared matrix");
887 
888 
889  DoubleFullUpperMatrixVectorSolve(isTrans,nRows,getLeadingDimension(),&(*this)(0,0),nB,incB,B);
890  }
891 
904  virtual tBoolean solve(const tBoolean& isLeft,
905  const tBoolean& isTrans,
906  const double &alpha,
907  LAP_DoubleFullGeneralMatrix& X) const {
908  return solve(isLeft,isTrans,*this,alpha,X);
909  }
910 
919  virtual tBoolean solve(const tBoolean& isTrans,
920  LAP_DoubleFullGeneralMatrix& X) const {
921  return solve(true,isTrans,*this,1.,X);
922  }
923 
936  static tBoolean solve(const tBoolean& isLeft,
937  const tBoolean& isTransA,
938  const LAP_DoubleFullUpperMatrix& A,
939  const double& alpha,
941 
946  return inverse(*this);
947  };
948 
949 public:
950 
955 
956  if ( A.getRowIncrement() != 1 )
957  cout<< "math/linal/core "<<"LAP_DoubleFullUpperMatrix::inverseMatrix() "<<"matrix is non-contiguous."<<endl;
958 
959 
961 
962  }
963 
964 
965 
966 };
967 #endif
LAP_DoubleFullUpperMatrix & operator+=(const LAP_DoubleFullUpperMatrix &s)
add the viewed matrix
Definition: LAP_DoubleFullUpperMatrix.h:196
this class describes the exceptions raised for LAP package
Definition: LAP_Exception.h:14
virtual void matrixProduct(const tBoolean &isTrans, const double &alpha, LAP_DoubleFullGeneralMatrix &A) const
compute A:=alpha op(This).A or A:=alpha A. op(This)
Definition: LAP_DoubleFullUpperMatrix.h:757
LAP_DoubleMatrixStorage & getStorage()
set the storage
Definition: LAP_DoubleMatrix.h:179
virtual ~LAP_DoubleFullUpperMatrix()
destroy a matrix
Definition: LAP_DoubleFullUpperMatrix.cpp:22
virtual tBoolean solve(const tBoolean &isTrans, LAP_DoubleFullGeneralMatrix &X) const
solve:
Definition: LAP_DoubleFullUpperMatrix.h:919
LAP_DoubleFullUpperMatrix & operator-=(const lapack_real &s)
sub s to the upper matrix
Definition: LAP_DoubleFullUpperMatrix.h:167
static SP::LAP_DoubleFullUpperMatrix New(const tLVectorIndex &n)
Definition: LAP_DoubleFullUpperMatrix.h:70
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This
Definition: LAP_DoubleFullUpperMatrix.h:811
void solve(const tBoolean &isTrans, LAP_DoubleVector &B) const
solve:
Definition: LAP_DoubleFullUpperMatrix.h:862
virtual void getRow(const tLVectorIndex &i, SP::LAP_DoubleVector v) const
get the i-th row in a vector
Definition: LAP_DoubleFullUpperMatrix.h:357
virtual tBoolean copyLower(const LAP_DoubleFullGeneralMatrix &f)
copy the transposed of the full matrix
Definition: LAP_DoubleFullUpperMatrix.cpp:58
virtual void vectorProduct(const LAP_DoubleVector &X, LAP_DoubleVector &Y) const
return Y=This.X
Definition: LAP_DoubleFullUpperMatrix.h:421
virtual tBoolean copy(const LAP_DoubleMatrix &x)
copy a matrix
Definition: LAP_DoubleMatrix.cpp:18
virtual void setSize(const tLVectorIndex &n)
set the dimension of the matrix and alocate the values array
Definition: LAP_DoubleFullUpperMatrix.h:237
double & getNullValue()
get a null value
Definition: LAP_Object.h:54
Definition: LAP_DoubleVector.h:20
Definition: LAP_DoubleMatrix.h:18
virtual void setValues(const tLVectorIndex &n, const tLVectorIndex &p, const double *values)
set the values
Definition: LAP_DoubleFullUpperMatrix.h:280
const tLVectorIncrement & getRowIncrement() const
get the row increment ie the memory distance between M(i,j) & M(i+1,j)
Definition: LAP_DoubleFullStorage.h:301
virtual 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_DoubleFullUpperMatrix.cpp:458
virtual void getRow(const tLVectorIndex &i, LAP_DoubleVector &v) const
get the i-th row in a vector
Definition: LAP_DoubleFullUpperMatrix.cpp:109
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_DoubleFullUpperMatrix.h:103
virtual void getColumn(const tLVectorIndex &j, LAP_DoubleVector &v) const
get the j-th column of this symmetric matrix in a vector
Definition: LAP_DoubleFullUpperMatrix.cpp:148
LAP_DoubleFullUpperMatrix & operator+=(const lapack_real &s)
add s to the upper matrix
Definition: LAP_DoubleFullUpperMatrix.h:159
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix n x p
Definition: LAP_Matrix.h:87
static tBoolean inverse(LAP_DoubleFullUpperMatrix &A)
inverse a symmetric matrix dsytrf & dsytri lapack methods called
Definition: LAP_DoubleFullUpperMatrix.h:954
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_ConstVector.h:170
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix and allocate the values array
Definition: LAP_DoubleFullUpperMatrix.h:224
virtual tLVectorIndex getViewedRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullStorage.h:285
virtual void setValues(const tLVectorIndex &n, const double *values)
set the values
Definition: LAP_DoubleFullUpperMatrix.h:293
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_DoubleFullUpperMatrix.h:439
#define tBoolean
Definition: types.h:48
this class describes a full upper matrix for lapack used
Definition: LAP_DoubleFullUpperMatrix.h:29
tLVectorIncrement getRowIncrement() const
get the memory distance between (*this)(i,j) & (*this)(i+1,j)
Definition: LAP_DoubleFullUpperMatrix.h:320
void DoubleFullUpperMatrixVectorProduct(const tBoolean &isTransA, const tLVectorIndex &nRowsA, const tLVectorIndex &ldA, const double *A, const tLVectorIndex &nX, const tLVectorIncrement &incX, double *x)
compute X=op(A). X where op(A)=A or op(A)=tA where A is Upper matrix
Definition: dfulluppermatrix_functions.cpp:125
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_DoubleFullUpperMatrix.h:343
#define lapack_real
Definition: lapack_functions.h:9
virtual tBoolean solve(const tBoolean &isLeft, const tBoolean &isTrans, const double &alpha, LAP_DoubleFullGeneralMatrix &X) const
solve:
Definition: LAP_DoubleFullUpperMatrix.h:904
virtual void setValues(const tLVectorIndex &n, const tLVectorIndex &p, SP::LAP_DoubleVector v)
set the values of the matrix to V without allocation the values array
Definition: LAP_DoubleFullUpperMatrix.h:246
static SP::LAP_DoubleFullUpperMatrix New()
Definition: LAP_DoubleFullUpperMatrix.h:63
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullUpperMatrix.h:335
LAP_DoubleFullUpperMatrix & operator-=(const LAP_DoubleFullUpperMatrix &s)
sub the viewed matrix
Definition: LAP_DoubleFullUpperMatrix.h:190
LAP_DoubleFullUpperMatrix & operator*=(const lapack_real &s)
multiply by s the matrix
Definition: LAP_DoubleFullUpperMatrix.h:146
#define null
Definition: types.h:13
virtual void rankProduct(const tBoolean &isTransU, const LAP_DoubleVector &Diag, LAP_DoubleVector &X) const
compute product
Definition: LAP_DoubleFullUpperMatrix.h:606
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_Vector.h:529
bool DoubleFullUpperMatrixInverse(const tLVectorIndex &nRowsA, const tLVectorIndex &ldA, double *A)
compute the inverse of the matrix
Definition: dfulluppermatrix_functions.cpp:341
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_DoubleFullUpperMatrix.h:478
void init(const double &v)
init the values
Definition: LAP_DoubleMatrixStorage.h:124
virtual void setValues(const tLVectorIndex &n, const double *values)
copy the values to the matrix values
Definition: LAP_DoubleFullStorage.h:195
LAP_DoubleFullUpperMatrix & operator*=(const LAP_DoubleFullUpperMatrix &s)
multiply the viewed matrices term by term
Definition: LAP_DoubleFullUpperMatrix.h:177
Definition: LAP_DoubleFullGeneralMatrix.h:30
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_Vector.h:519
virtual void setValues(SP::LAP_DoubleVector v)
set the values of the matrix to V without allocation the values array
Definition: LAP_DoubleFullUpperMatrix.h:265
virtual void vectorProduct(const tBoolean &isTrans, const LAP_DoubleVector &X, LAP_DoubleVector &Y) const
return Y=op(This).X
Definition: LAP_DoubleFullUpperMatrix.h:429
LAP_DoubleFullUpperMatrix & operator=(const LAP_DoubleFullUpperMatrix &s)
init all the matrix to s
Definition: LAP_DoubleFullUpperMatrix.h:128
virtual tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U)
compute the eigen values decomposition on this: A is destroyed such that it contains the eigen vector...
Definition: LAP_DoubleFullUpperMatrix.cpp:762
void matrixProduct(const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoubleFullUpperMatrix.h:704
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_DoubleFullUpperMatrix.cpp:335
LAP_DoubleFullUpperMatrix & operator^=(const lapack_real &s)
power by s the matrix v
Definition: LAP_DoubleFullUpperMatrix.h:139
virtual void setValuesNumber(const tLVectorIndex &nRows, const tLVectorIndex &n)
set the values number
Definition: LAP_DoubleFullStorage.h:213
virtual tLVectorIndex getViewedColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullStorage.h:290
void DoubleFullUpperMatrixVectorSolve(const tBoolean &isTransA, const tLVectorIndex &nARows, const tLVectorIndex &ldA, const double *A, const tLVectorIndex &nB, const tLVectorIncrement &incB, double *B)
solve op(A).X=Y and Y:=X
Definition: dfulluppermatrix_functions.cpp:403
void indexMin(tLVectorIndex &i, tLVectorIndex &j) const
get the index of the min view element in absolute value
Definition: LAP_DoubleFullUpperMatrix.cpp:492
DEFINE_SPTR(LAP_DoubleFullGeneralMatrix)
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_DoubleFullUpperMatrix.h:110
Definition: LAP_DoubleFullStorage.h:29
this class describes a general double symmetric matrix
Definition: LAP_DoubleUpperMatrix.h:17
virtual tReal norm2() const
return norm2 sqrt(sum_ij(aij^2))=sqrt(tr(AtA));
Definition: LAP_DoubleFullUpperMatrix.cpp:279
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_DoubleFullUpperMatrix.cpp:685
static SP::LAP_DoubleFullUpperMatrix Identity(const tLVectorIndex &nRows)
create an identity matrix
Definition: LAP_DoubleFullUpperMatrix.h:77
#define tLVectorIndex
Definition: lapack_types.h:13
void vectorProduct(const tBoolean &isTrans, const tLVectorIndex &nX, const tLVectorIncrement &incX, double *X) const
compute X:=alpha. op(A). X
Definition: LAP_DoubleFullUpperMatrix.h:558
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
static tBoolean computeEigenValues(const LAP_DoubleFullUpperMatrix &A, LAP_DoubleVector &U)
compute the eigen values of A and A is destroyed after method
Definition: LAP_DoubleFullUpperMatrix.h:791
LAP_DoubleFullUpperMatrix & operator/=(const LAP_DoubleFullUpperMatrix &s)
divide the viewed matrices term by term
Definition: LAP_DoubleFullUpperMatrix.h:183
virtual void solve(const tBoolean &isTrans, const tLVectorIndex &nB, const tLVectorIncrement &incB, double *B) const
solve:
Definition: LAP_DoubleFullUpperMatrix.h:879
LAP_DoubleFullUpperMatrix()
build a matrix
Definition: LAP_DoubleFullUpperMatrix.cpp:6
void vectorProduct(const tBoolean &isTrans, const double &alpha, LAP_DoubleVector &X) const
Definition: LAP_DoubleFullUpperMatrix.h:521
virtual void setValuesPointer(SP::LAP_DoubleVector v)
set the values of without copying
Definition: LAP_DoubleFullStorage.h:180
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_DoubleFullUpperMatrix.h:744
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullUpperMatrix.h:330
#define tLVectorIncrement
Definition: lapack_types.h:16
tBoolean inverse()
inverse the matrix
Definition: LAP_DoubleFullUpperMatrix.h:945
virtual SP::LAP_DoubleMatrix NewInstance() const
create a New instance of this
Definition: LAP_DoubleFullUpperMatrix.h:92
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
tLVectorIndex getLeadingDimension() const
get the leading dimension ie the memory distance between M(i,j) & M(i,j+1)
Definition: LAP_DoubleFullStorage.h:296
Definition: LAP_ConstDoubleVector.h:25
virtual void vectorProduct(const tBoolean &isTrans, LAP_DoubleVector &X) const
compute X:=op(This).X
Definition: LAP_DoubleFullUpperMatrix.h:513
tLVectorIndex getLeadingDimension() const
get the memory distance between (*this)(i,j) & (*this)(i,j+1)
Definition: LAP_DoubleFullUpperMatrix.h:325
#define tReal
Definition: types.h:18
LAP_DoubleFullUpperMatrix & operator/=(const lapack_real &s)
divide by s the matrix v
Definition: LAP_DoubleFullUpperMatrix.h:152
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
#define ASSERT_IN(a)
Definition: types.h:96
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14
LAP_DoubleFullUpperMatrix & operator=(const double &s)
init all the matrix to s
Definition: LAP_DoubleFullUpperMatrix.h:121
virtual void rankProduct(const tBoolean &isTransU, LAP_DoubleVector &X) const
compute product
Definition: LAP_DoubleFullUpperMatrix.h:643