C++ main module for mmsd Package  1.0
LAP_DoublePackedUpperMatrix.h
Go to the documentation of this file.
1 #ifndef LAP_DoublePackedUpperMatrix_H
2 #define LAP_DoublePackedUpperMatrix_H
3 
4 
7 
8 #include "LAP_DoubleVector.h"
9 
10 
12 
13 
16 #include "dvector_functions.h"
17 
18 DEFINE_SPTR(LAP_DoublePackedMatrix);
19 
30 
31  SP_OBJECT(LAP_DoublePackedUpperMatrix);
32 
33 private:
34  // ATTRIBUTES
35 
36  // ASSOCIATIONS
37 
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_DoublePackedUpperMatrix New() {
64  SP::LAP_DoublePackedUpperMatrix p(new LAP_DoublePackedUpperMatrix(),
66  p->setThis(p);
67  return p;
68  };
69 
70  inline static SP::LAP_DoublePackedUpperMatrix New(const tLVectorIndex& n) {
71  SP::LAP_DoublePackedUpperMatrix p=New();
72  p->setSize(n);
73  return p;
74  };
77  virtual SP::LAP_DoubleMatrix NewInstance() const {
78  return New();
79  }
80 
81  //-----------
82  // OPERATORS
83  // ----------
84 
85 
89  virtual double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) {
90  return (i<=j)?getPackedStorage()(i,j):getNullValue();
91  };
92 
96  virtual const double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) const {
97  return (i<=j)?getPackedStorage()(i,j):getNullValue();
98  };
99 
100 
101  //scalar operators
102  //================
103 
107  getPackedStorage()^=s;
108  return (*this);
109  }
110 
114  getPackedStorage()*=s;
115  return (*this);
116  }
120  getPackedStorage()/=s;
121  return (*this);
122  }
123 
127  getPackedStorage()+=s;
128  return (*this);
129  }
130 
131 
135  getPackedStorage()-=s;
136  return (*this);
137  }
138 
139  //pack matrix operator
140  //=====================
141 
145  getPackedStorage()*=s.getPackedStorage();
146  return (*this);
147  }
151  getPackedStorage()/=s.getPackedStorage();
152  return (*this);
153  }
154 
158  getPackedStorage()-=s.getPackedStorage();
159  return (*this);
160  }
164  getPackedStorage()+=s.getPackedStorage();
165  return (*this);
166  }
167 
168 
169 
170 
171  //copy operator
172  //=============
173 
177  getStorage().init(s);
178  return (*this);
179  };
183  copy(s);
184  return (*this);
185  };
186 
187 
188 
189 
190 public:
191 
192 
198 
199 
200  //dimension setting
201  //=================
202 
206  virtual void setSize(const tLVectorIndex & nRows,const tLVectorIndex& nCols) {
207  tLVectorIndex d=(nRows<nCols)?nRows:nCols;
209 
211  }
212 
216  virtual void setSize(const tLVectorIndex & n) {
218 
219  getStorage().setValuesNumber( ( (tLVectorIndex)n)*((tLVectorIndex)(n+1)) /2 );
220  }
221 
222  // values setting
223  //================
224 
229  virtual void setValues(SP::LAP_DoubleVector values) {
230  ASSERT_IN(values.get()!=null);
231 
232  //compute the number of columns
233  tLVectorIndex n=values->getSize();
234  n=( ((sqrt(1+8*n)-1)/2) +0.5);
235 
237 
238  //set the values pointer
239  getStorage().setValuesPointer(values);
240 
241  }
242 
245  virtual void setValues(const tLVectorIndex& n,const double* values) {
246 
247  tLVectorIndex nRows=( ((sqrt(1+8*n)-1)/2) +0.5);
248  LAP_DoubleUpperMatrix::setSize(nRows,nRows);
249 
250  //set the values
251  getStorage().setValues(n,values);
252 
253  }
254 
256  //======
257 private:
260  inline LAP_DoublePackedStorage& getPackedStorage() {
261  return *dynamic_cast<LAP_DoublePackedStorage*>(&getStorage());
262  };
265  inline const LAP_DoublePackedStorage& getPackedStorage() const {
266  return *dynamic_cast<const LAP_DoublePackedStorage*>(&getStorage());
267  };
268 
269 public:
272  virtual void getColumn(const tLVectorIndex& j,LAP_DoubleVector& v) const;
275  virtual void getColumn(const tLVectorIndex& j,SP::LAP_DoubleVector v) const {
276  ASSERT_IN(v.get()!=null);
277  getColumn(j,*v.get());
278  };
279 
282  virtual void getRow(const tLVectorIndex& i,LAP_DoubleVector& v) const;
283 
286  virtual void getRow(const tLVectorIndex& i,SP::LAP_DoubleVector v) const {
287  ASSERT_IN(v.get()!=null);
288  getRow(i,*v.get());
289  };
290 
291 
292 
293 
294 
295  // ------------------------
296  // operation on matrix
297  // ------------------------
298 public:
299 
300 
303  virtual tReal norm2() const;
304 
307  virtual tReal norm2(LAP_DoubleVector& v) const;
308 
309 
310 
311 
312 
318  virtual tReal sum(const tFlag& d,LAP_DoubleVector& s) const;
319 
325  virtual tReal sum(const tFlag& d,const tLVectorIndex& index) const;
326 
327 
328 
329 
330 
331 
332  // ----------------
333  // vector product
334  // ----------------
335 
336 public:
341  virtual void vectorProduct(const tBoolean& isTrans,LAP_DoubleVector& X) const {
342  vectorProduct(isTrans,1,X);
343  } /* \brief compute X:=alpha.op(This).X
344  * @param isTrans : if (isTrans) op(A)=A else op(A)=tA
345  * @param alpha: alpha value
346  * @param X: X
347  */
348  inline void vectorProduct(const tBoolean& isTrans,const double& alpha,LAP_DoubleVector& X) const {
349  if (alpha==0) X=0;
350  else {
353  if (nRows==nCols) {
354  //X:=op(This).X
355  vectorProduct(isTrans,nRows,X.getIncrement(),&X(0));
356  //X*=alpha
357  if (alpha!=1) X*=alpha;
358  }
359  else {
361  Y.setSize(nRows);
362  vectorProduct(isTrans,
363  X.getSize(),X.getIncrement(),&X(0),
364  alpha,0.,
365  Y.getSize(),Y.getIncrement(),&Y(0));
366  X.copy(Y);
367  }
368  }
369 
370  };
371 
372 
378  virtual void vectorProduct(const tBoolean& isTrans,const LAP_DoubleVector& X,LAP_DoubleVector& Y) const {
379  vectorProduct(isTrans,X,1.,0.,Y);
380  }
381 
389  void vectorProduct(const tBoolean& isTrans,
390  const LAP_DoubleVector& X,
391  const lapack_real& alpha,
392  const lapack_real& beta,
393  LAP_DoubleVector& Y) const {
394  //get the dimenson of Matrix
397 
398  if (nRows==0) return;
399 
400  if (isTrans) std::swap(nRows,nCols);
401 
402  tLVectorIndex nX=X.getSize();
403 
404  //verify the dimension of X
405  if (nX!=nCols) {
406  throw LAP_Exception("math/linalg/core","LAP_DoublePackedUpperMatrix::product()","incompatible size of X vector");
407  }
408  //verify the packed upper marix is squared
409  if (nRows!=nCols) {
410  throw LAP_Exception("math/linalg/core","LAP_DoublePackedUpperMatrix::product()","only squared matrix");
411  }
412 
413  //create the right dimension of return vector Y
414  if (beta==0) {
415  //Y=X
416  Y.copy(X);
417  //Y=op(A).X
418  vectorProduct(isTrans,nRows,Y.getIncrement(),&Y(0));
419  //Y=alpha.op(A).X
420  if (alpha!=1) Y*=alpha;
421  return;
422  }
423 
424  //verify the dimension of Y
425  tLVectorIndex nY=Y.getSize();
426  if (nY!=nRows) {
427  throw LAP_Exception("math/linalg/core","LAP_DoublePackedUpperMatrix::product()","incompatible size of Y vector");
428  }
429 
430  //test if the lapack mat-vector routine can be called : Y:=alpha.op(A).X
431 
432  vectorProduct(isTrans,
433  nX,X.getIncrement(),&X(0),
434  alpha,
435  beta,
436  nY,Y.getIncrement(),&Y(0));
437  };
438 
446  void vectorProduct(const tBoolean& isTrans,
447  const LAP_ConstDoubleVector& X,
448  const lapack_real& alpha,
449  const lapack_real& beta,
450  LAP_DoubleVector& Y) const {
451  //get the dimenson of Matrix
454  if (isTrans) std::swap(nRows,nCols);
455 
456  tLVectorIndex nX=X.getSize();
457 
458  //verify the dimension of X
459  if (nX!=nCols) {
460  throw LAP_Exception("math/linalg/core","LAP_DoublePackedUpperMatrix::product()","incompatible size of X vector");
461  }
462 
463  if (beta==0) {
464  Y.setSize(nRows);
465  }
466  tLVectorIndex nY=Y.getSize();
467  if (nY!=nRows) {
468  throw LAP_Exception("math/linalg/core","LAP_DoublePackedUpperMatrix::product()","incompatible size of Y vector");
469  }
470 
471  vectorProduct(isTrans,
472  nX,X.getIncrement(),&X(0),
473  alpha,
474  beta,
475  nY,Y.getIncrement(),&Y(0));
476  };
477 
478 
479 
480 public:
481 
482 
491  inline void vectorProduct(const tBoolean& isTrans,const tLVectorIndex& nX,const tLVectorIncrement& incX,double* X) const {
492 
495  if (nRows==0) return;
496 
497  if (nRows!=nCols) {
498  throw LAP_Exception("math/linalg/core","LAP_DoublePackedUpperMatrix::product()",
499  "X=A.X needs to have a squared matrix");
500  }
501  if (nCols!=nX) {
502  throw LAP_Exception("math/linal/core","LAP_DoublePackedUpperMatrix::product","incompatible size of X vector");
503  }
504 
506  nRows,
507  &(*this)(0,0),
508  nX,incX,X);
509  }
522  void vectorProduct(const tBoolean& isTrans,
523  const tLVectorIndex& nX,const tLVectorIncrement& incX,const double *x,
524  const double& alpha,const double& beta,
525  const tLVectorIndex& nY,const tLVectorIncrement& incY,double *y) const;
526 
527 
528 public:
529 
535  virtual void rankProduct(const tBoolean& isTransU,
536  const LAP_DoubleVector& Diag,
537  LAP_DoubleVector& X) const{
538  tLVectorIndex nX=X.getSize();
539 
540  if (nX!=getRowsNumber()) {
541  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:rankDProduct","incompatible dimension of vector");
542  }
543  if (nX!=getColumnsNumber()) {
544  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:rankDProduct","incompatible dimension of vector");
545  }
546  if (nX!=Diag.getSize()) {
547  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:rankDProduct","incompatible dimension of vectors");
548  }
550  getRowsNumber(),
551  &(*this)(0,0),
552  X.getSize(),X.getIncrement(),&X(0));
553 
554  X*=Diag;
555 
557  getRowsNumber(),
558  &(*this)(0,0),
559  X.getSize(),X.getIncrement(),&X(0));
560  }
561 
562 
567  virtual void rankProduct(const tBoolean& isTransU,LAP_DoubleVector& X) const{
568  tLVectorIndex nX=X.getSize();
569 
570  if (nX!=getRowsNumber()) {
571  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:rankProduct","incompatible dimension of vector");
572  }
573  if (nX!=getColumnsNumber()) {
574  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:rankProduct","incompatible dimension of vector");
575  }
577  getRowsNumber(),
578  &(*this)(0,0),
579  X.getSize(),X.getIncrement(),&X(0));
581  getRowsNumber(),
582  &(*this)(0,0),
583  X.getSize(),X.getIncrement(),&X(0));
584 
585  }
586 
587 
588 
589 
590 
591 public:
592 
593 
594  // ----------------
595  // matrix product
596  // ----------------
601  virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix& B) const;
602 
603 
604  // ----------------
611  LAP_DoubleFullGeneralMatrix& C) const;
612 
613 
614 
615  //product with full matrix
616  //-------------------------
617 
623  LAP_DoubleFullGeneralMatrix& C) const {
624 
625  matrixProduct(false,false,B,1.,C);
626  };
627 
634  LAP_DoubleFullGeneralMatrix& C) const;
635 
636 
648  void matrixProduct(const tBoolean& isLeft,
649  const tBoolean& isTrans,
651  const double& alpha,
652  LAP_DoubleFullGeneralMatrix& C) const;
653 
654 
662  virtual void matrixProduct(const tBoolean& isLeft,
663  const tBoolean& isTrans,
664  const double& alpha,
665  LAP_DoubleFullGeneralMatrix& A) const {
666  matrixProduct(isLeft,isTrans,*this,alpha,A);
667  }
675  virtual void matrixProduct(const tBoolean& isTrans,
676  const double& alpha,
677  LAP_DoubleFullGeneralMatrix& A) const {
678  matrixProduct(true,isTrans,*this,alpha,A);
679  }
680 
681 
682 
691  static void matrixProduct(const tBoolean& isLeft,
692  const tBoolean& isTransA,
694  const lapack_real& alpha,
696 
697 
698 
699 
700  // ----------------------
701  // eigen values & vectors
702  // ------------------------
703 public:
704 
705 
709  LAP_DoubleVector& U) {
710 
711  tLVectorIndex i,nRows=A.getRowsNumber();
712  U.setSize(nRows);
713  double *U_i=&U(0);
714  const tLVectorIncrement&incU=U.getIncrement();
715  const double *A_ii=&A(0,0);
716  for (i=0;i<nRows;i++) {
717  *U_i=*A_ii;
718  U_i+=incU;
719  A_ii+=(i+2);
720  }
721  return true;
722  }
723 
727  return computeEigenValues(*this,U);
728  };
729 
730 
731 
732 
733 
734  // -----------------------
735  // linear system solver
736  // -----------------------
737 
746  virtual void solve(const tBoolean& isTrans,
747  LAP_DoubleVector& B) const {
748  tLVectorIndex nB=B.getSize();
749  if (nB!=0)
750  solve(isTrans,B.getSize(),B.getIncrement(),&B(0));
751  }
762  virtual void solve(const tBoolean& isTrans,
763  const tLVectorIndex& nB,const tLVectorIncrement& incB,double *B) const {
764 
767  if (nRows==0) return;
768  if (nRows!=nB)
769  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:solve","incompatible dimension of vector");
770  if (nRows!=nCols)
771  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:solve","only be used with squared matrix");
772 
773  DoublePackedUpperMatrixVectorSolve(isTrans,nRows,&(*this)(0,0),nB,incB,B);
774  }
775 
784  virtual tBoolean solve(const tBoolean& isTrans,
785  LAP_DoubleFullGeneralMatrix& X) const {
786  return solve(isTrans,*this,X);
787  }
788 
798  static tBoolean solve(const tBoolean& isTransA,
801 
802  tLVectorIndex nARows=A.getRowsNumber();
803  tLVectorIndex nBRows=B.getRowsNumber();
804  tLVectorIndex nBCols=B.getColumnsNumber();
806 
807  if (nARows==0) return true;
808 
809  if (nARows!=nBRows)
810  throw LAP_Exception("math/linal/core"," LAP_DoublePackedUpperMatrix:solve","incompatible size of matrices");
811 
812  return DoublePackedUpperMatrixSolve(isTransA,nARows,&A(0,0),nBCols,ldb,&B(0,0));
813 
814 
815  }
816 
817 
822  return inverse(*this);
823  };
824 
825 public:
826 
831 
832 
833  int nRows=A.getRowsNumber();
834  if (nRows==0) return true;
835 
836  return DoublePackedUpperMatrixInverse(nRows,&A(0,0));
837 
838  }
839 
840 
841 
842 };
843 #endif
virtual tReal norm2() const
return norm2 sqrt(sum_ij(aij^2))=sqrt(tr(AtA));
Definition: LAP_DoublePackedUpperMatrix.cpp:189
virtual ~LAP_DoublePackedUpperMatrix()
destroy a matrix
Definition: LAP_DoublePackedUpperMatrix.cpp:24
LAP_DoublePackedUpperMatrix & operator-=(const lapack_real &s)
sub s to the upper matrix
Definition: LAP_DoublePackedUpperMatrix.h:134
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
virtual void vectorProduct(const tBoolean &isTrans, const LAP_DoubleVector &X, LAP_DoubleVector &Y) const
return Y=op(This).X
Definition: LAP_DoublePackedUpperMatrix.h:378
this class describes a packed storage by column
Definition: LAP_DoublePackedStorage.h:21
LAP_DoublePackedUpperMatrix & operator=(const double &s)
init all the matrix to s
Definition: LAP_DoublePackedUpperMatrix.h:176
virtual void setValuesPointer(SP::LAP_DoubleVector v)
set the vector values by reference
Definition: LAP_DoubleMatrixStorage.h:132
virtual void getColumn(const tLVectorIndex &j, LAP_DoubleVector &v) const
get the j-th column of this symmetric matrix in a vector
Definition: LAP_DoublePackedUpperMatrix.cpp:113
void vectorProduct(const tBoolean &isTrans, const tLVectorIndex &nX, const tLVectorIncrement &incX, double *X) const
compute X:=op(A). X
Definition: LAP_DoublePackedUpperMatrix.h:491
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_DoublePackedUpperMatrix.h:275
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
virtual void setValues(const tLVectorIndex &n, const double *values)
set the values
Definition: LAP_DoublePackedUpperMatrix.h:245
virtual void getRow(const tLVectorIndex &i, SP::LAP_DoubleVector v) const
get the i-th row in a vector
Definition: LAP_DoublePackedUpperMatrix.h:286
LAP_DoublePackedUpperMatrix & operator-=(const LAP_DoublePackedUpperMatrix &s)
sub the viewed matrix
Definition: LAP_DoublePackedUpperMatrix.h:157
Definition: LAP_DoubleVector.h:20
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_DoublePackedUpperMatrix.h:96
Definition: LAP_DoubleMatrix.h:18
void DoublePackedUpperMatrixVectorProduct(const tBoolean &isTransA, const tLVectorIndex &nRowsA, const double *A, const tLVectorIndex &nX, const tLVectorIncrement &incX, double *x)
Definition: dpackeduppermatrix_functions.cpp:96
virtual tBoolean solve(const tBoolean &isTrans, LAP_DoubleFullGeneralMatrix &X) const
solve:
Definition: LAP_DoublePackedUpperMatrix.h:784
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix n x p
Definition: LAP_Matrix.h:87
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_ConstVector.h:170
#define tBoolean
Definition: types.h:48
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_DoublePackedUpperMatrix.h:446
#define lapack_real
Definition: lapack_functions.h:9
LAP_DoublePackedUpperMatrix & operator*=(const lapack_real &s)
multiply by s the matrix
Definition: LAP_DoublePackedUpperMatrix.h:113
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:366
virtual tBoolean copyLower(const LAP_DoubleFullGeneralMatrix &f)
copy the transposed of the full matrix
Definition: LAP_DoublePackedUpperMatrix.cpp:28
virtual SP::LAP_DoubleMatrix NewInstance() const
create a New instance of this
Definition: LAP_DoublePackedUpperMatrix.h:77
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_DoublePackedUpperMatrix.h:389
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_DoublePackedUpperMatrix.h:229
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This
Definition: LAP_DoublePackedUpperMatrix.h:726
#define null
Definition: types.h:13
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_Vector.h:529
virtual void solve(const tBoolean &isTrans, LAP_DoubleVector &B) const
solve:
Definition: LAP_DoublePackedUpperMatrix.h:746
void init(const double &v)
init the values
Definition: LAP_DoubleMatrixStorage.h:124
LAP_DoublePackedUpperMatrix()
build a matrix
Definition: LAP_DoublePackedUpperMatrix.cpp:12
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
virtual void setSize(const tLVectorIndex &n)
set the dimension of the matrix
Definition: LAP_DoublePackedUpperMatrix.h:216
void DoublePackedUpperMatrixVectorSolve(const tBoolean &isTransA, const tLVectorIndex &nARows, const double *A, const tLVectorIndex &nB, const tLVectorIncrement &incB, double *B)
Definition: dpackeduppermatrix_functions.cpp:181
static SP::LAP_DoublePackedUpperMatrix New()
Definition: LAP_DoublePackedUpperMatrix.h:63
LAP_DoublePackedUpperMatrix & operator=(const LAP_DoubleMatrix &s)
init all the matrix to s
Definition: LAP_DoublePackedUpperMatrix.h:182
LAP_DoublePackedUpperMatrix & operator/=(const lapack_real &s)
divide by s the matrix v
Definition: LAP_DoublePackedUpperMatrix.h:119
tBoolean inverse()
inverse the matrix
Definition: LAP_DoublePackedUpperMatrix.h:821
this class describes a general double symmetric matrix
Definition: LAP_DoubleUpperMatrix.h:17
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_DoublePackedUpperMatrix.h:675
virtual void getRow(const tLVectorIndex &i, LAP_DoubleVector &v) const
get the i-th row in a vector
Definition: LAP_DoublePackedUpperMatrix.cpp:75
LAP_DoublePackedUpperMatrix & operator+=(const LAP_DoublePackedUpperMatrix &s)
add the viewed matrix
Definition: LAP_DoublePackedUpperMatrix.h:163
tBoolean DoublePackedUpperMatrixInverse(const tLVectorIndex &nRows, double *A)
Definition: dpackeduppermatrix_functions.cpp:394
virtual void rankProduct(const tBoolean &isTransU, const LAP_DoubleVector &Diag, LAP_DoubleVector &X) const
compute product
Definition: LAP_DoublePackedUpperMatrix.h:535
static tBoolean solve(const tBoolean &isTransA, const LAP_DoublePackedUpperMatrix &A, LAP_DoubleFullGeneralMatrix &B)
solve:
Definition: LAP_DoublePackedUpperMatrix.h:798
void matrixProduct(const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoublePackedUpperMatrix.h:622
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_DoublePackedUpperMatrix.cpp:384
#define tLVectorIndex
Definition: lapack_types.h:13
this class describes a packed upper matrix for lapack used where values are stored in vector: {A(0...
Definition: LAP_DoublePackedUpperMatrix.h:29
DEFINE_SPTR(LAP_DoublePackedMatrix)
void vectorProduct(const tBoolean &isTrans, const double &alpha, LAP_DoubleVector &X) const
Definition: LAP_DoublePackedUpperMatrix.h:348
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_DoublePackedUpperMatrix.h:662
virtual void solve(const tBoolean &isTrans, const tLVectorIndex &nB, const tLVectorIncrement &incB, double *B) const
solve:
Definition: LAP_DoublePackedUpperMatrix.h:762
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
static tBoolean inverse(LAP_DoublePackedUpperMatrix &A)
inverse a symmetric matrix dsytrf & dsytri lapack methods called
Definition: LAP_DoublePackedUpperMatrix.h:830
tLVectorIndex getLeadingDimension() const
get the memory distance between (*this)(i,j) & (*this)(i,j+1)
Definition: LAP_DoubleFullGeneralMatrix.h:351
virtual void vectorProduct(const tBoolean &isTrans, LAP_DoubleVector &X) const
compute X:=op(This).X
Definition: LAP_DoublePackedUpperMatrix.h:341
LAP_DoublePackedUpperMatrix & operator^=(const lapack_real &s)
power by s the matrix v
Definition: LAP_DoublePackedUpperMatrix.h:106
virtual void setSize(const tLVectorIndex &nRows, const tLVectorIndex &nCols)
set the dimension of the matrix
Definition: LAP_DoublePackedUpperMatrix.h:206
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:371
virtual void rankProduct(const tBoolean &isTransU, LAP_DoubleVector &X) const
compute product
Definition: LAP_DoublePackedUpperMatrix.h:567
LAP_DoublePackedUpperMatrix & operator*=(const LAP_DoublePackedUpperMatrix &s)
multiply the viewed matrices term by term
Definition: LAP_DoublePackedUpperMatrix.h:144
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_Matrix.h:121
tBoolean DoublePackedUpperMatrixSolve(const tBoolean &isTransA, const tLVectorIndex &nARows, const double *A, const tLVectorIndex &nBCols, const tLVectorIndex &ldB, double *B)
Definition: dpackeduppermatrix_functions.cpp:433
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_DoublePackedUpperMatrix.cpp:211
static tBoolean computeEigenValues(const LAP_DoublePackedUpperMatrix &A, LAP_DoubleVector &U)
compute the eigen values of A and A is destroyed after method
Definition: LAP_DoublePackedUpperMatrix.h:708
LAP_DoublePackedUpperMatrix & operator+=(const lapack_real &s)
add s to the upper matrix
Definition: LAP_DoublePackedUpperMatrix.h:126
#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 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_DoublePackedUpperMatrix.h:89
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
#define ASSERT_IN(a)
Definition: types.h:96
static SP::LAP_DoublePackedUpperMatrix New(const tLVectorIndex &n)
Definition: LAP_DoublePackedUpperMatrix.h:70
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14
LAP_DoublePackedUpperMatrix & operator/=(const LAP_DoublePackedUpperMatrix &s)
divide the viewed matrices term by term
Definition: LAP_DoublePackedUpperMatrix.h:150