C++ main module for mmsd Package  1.0
LAP_DoubleFullSymmetricMatrix.h
Go to the documentation of this file.
1 #ifndef LAP_DoubleFullSymmetricMatrix_H
2 #define LAP_DoubleFullSymmetricMatrix_H
3 
4 //inheritance classes
6 
7 //vector classes
8 #include "LAP_DoubleVector.h"
9 #include "LAP_IntegerVector.h"
10 
11 //association classes
12 #include "LAP_DoubleFullStorage.h"
13 
14 //C-lapack routines
16 
17 //friend classes
21 
22 
32 
34 
35 private:
36  // ATTRIBUTES
37 
38  // ASSOCIATIONS
39 
40 
41 
42  // METHOD
43 
44 
45 public:
46  // CONSTRUCTORS
53 
54  // DESTRUCTORS
58 
59 
60 
61  // -------------
62  // NEW METHODS
63  // -------------
64 public:
65 
66  inline static SP::LAP_DoubleFullSymmetricMatrix New() {
67  SP::LAP_DoubleFullSymmetricMatrix p(new LAP_DoubleFullSymmetricMatrix(),
69  p->setThis(p);
70  return p;
71  };
72 
73  inline static SP::LAP_DoubleFullSymmetricMatrix New(const tLVectorIndex& n) {
74  SP::LAP_DoubleFullSymmetricMatrix p=New();
75  p->setSize(n);
76  return p;
77  };
78 
81  inline static SP::LAP_DoubleFullSymmetricMatrix Identity(const tLVectorIndex& nRows) {
82  SP::LAP_DoubleFullSymmetricMatrix p=New(nRows);
83 
84  double *vs=&(*p.get())[0];
85  for (tLVectorIndex i=0;i<nRows-1;i++) {
86  *vs=1;
87  vs+=nRows+1;
88 
89  }
90  *vs=1;
91  return p;
92  }
93 
96  virtual SP::LAP_DoubleMatrix NewInstance() const {
97  return New();
98  }
99 
100  //-----------
101  // OPERATORS
102  // ----------
103 
107  virtual double& operator()(const tLVectorIndex & i,const tLVectorIndex& j) {
108  return (j<i)? getFullStorage()(j,i):getFullStorage()(i,j);
109  };
110 
114  virtual const double& operator()(const tLVectorIndex& i,const tLVectorIndex& j) const {
115  return (j<i)? getFullStorage()(j,i):getFullStorage()(i,j);
116  };
117 
118 
119 
120 
121  //copy operator
122  //=============
123 
127  getStorage().init(s);
128  return (*this);
129  };
133  copy(s);
134  return (*this);
135  };
136 
137  //scalar operators
138  //================
139 
143  getFullStorage()^=s;
144  return (*this);
145  }
146 
150  getFullStorage()*=s;
151  return (*this);
152  }
156  getFullStorage()/=s;
157  return (*this);
158  }
159 
163  getFullStorage()+=s;
164  return (*this);
165  }
166 
167 
171  getFullStorage()-=s;
172  return (*this);
173  }
174 
175  //pack matrix operator
176  //=====================
177 
182  return (*this);
183  }
188  return (*this);
189  }
190 
195  return (*this);
196  }
201  return (*this);
202  }
209 
216 
217 
218  // ----------------
219  // MATRIX SETTINGS
220  // ----------------
221 public:
225 public:
226 
227 
231  virtual void setSize(const tLVectorIndex& n,const tLVectorIndex& p) {
232 
233  tLVectorIndex d=(n<p)?n:p;
234  //set the number of the matrix
236 
237  //set the storage
238  tLVectorIndex dim=((tLVectorIndex)d);
239  dim*=dim;
240 
242 
243  }
247  virtual void setSize(const tLVectorIndex & n) {
248  setSize(n,n);
249  }
250 
256  virtual void setValues(SP::LAP_DoubleVector v) {
257 
258 
259  tLVectorIndex m=v->getSize();
260  tLVectorIndex nRows=(tLVectorIndex) (sqrt(m)+0.5);
262 
263  //set the vector values
264  getFullStorage().setValuesPointer(nRows,v);
265  };
266 
271  virtual void setValues(const tLVectorIndex& n,
272  const double* values) {
273  tLVectorIndex nRows=(tLVectorIndex) (sqrt(n)+0.5);
275  //set the storage
276  getFullStorage().setValues(nRows,n,values);
277  }
278 
280  //======
281 public:
285  return *dynamic_cast<LAP_DoubleFullStorage*>(&getStorage());
286  };
289  inline const LAP_DoubleFullStorage& getFullStorage() const {
290  return *dynamic_cast<const LAP_DoubleFullStorage*>(&getStorage());
291  };
292 
293 public:
297  return getFullStorage().getRowIncrement();
298  }
303  }
306  virtual tLVectorIndex getRowsNumber() const {
308  };
311  virtual tLVectorIndex getColumnsNumber() const {
313  };
314 
317  virtual void getColumn(const tLVectorIndex& j,LAP_DoubleVector& v) const;
320  virtual void getColumn(const tLVectorIndex& j,SP::LAP_DoubleVector v) const {
321  ASSERT_IN(v.get()!=null);
322  getColumn(j,*v.get());
323  };
324 
330  }
336  }
339  virtual void getRow(const tLVectorIndex& i,LAP_DoubleVector& v) const;
340 
343  virtual void getRow(const tLVectorIndex& i,SP::LAP_DoubleVector v) const {
344  ASSERT_IN(v.get()!=null);
345  getRow(i,*v.get());
346  };
347 
348 
349 
350 
351  // ------------------------
352  // operation on matrix
353  // ------------------------
354 public:
355 
356 
359  virtual tReal norm2() const;
360 
363  virtual tReal norm2(LAP_DoubleVector& v) const;
364 
365 
366 
367 
368 
374  virtual tReal sum(const tFlag& d,LAP_DoubleVector& s) const;
375 
381  virtual tReal sum(const tFlag& d,const tLVectorIndex& index) const;
382 
388  virtual tReal max(const tFlag& d,const tLVectorIndex& index) const;
389 
394  void indexMin(tLVectorIndex& i,tLVectorIndex& j) const;
395 
396 
397 
398 
399 
400  // ----------------
401  // vector product
402  // ----------------
403 
404 public:
405 
408  virtual void vectorProduct(const LAP_DoubleVector& X,LAP_DoubleVector& Y) {
410  }
411 
418  virtual void vectorProduct(const LAP_DoubleVector& X,
419  const lapack_real& alpha,
420  const lapack_real& beta,
421  LAP_DoubleVector& Y) const {
422  //get the dimenson of Matrix
424 
425  tLVectorIndex nX=X.getSize();
426 
427  //verify the dimension of X
428  if (nX!=nRows) {
429  throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of X vector");
430  }
431 
432  //set the dimension of Y is beta=0
433  if (beta==0) {
434  Y.setSize(nRows);
435  }
436  tLVectorIndex nY=Y.getSize();
437  if (nY!=nRows) {
438  throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of Y vector");
439  }
440  //make the product
441  vectorProduct(nX,X.getIncrement(),&X(0),
442  alpha,
443  beta,
444  nY,Y.getIncrement(),&Y(0));
445  };
446 
453  virtual void vectorProduct(const LAP_ConstDoubleVector& X,
454  const lapack_real& alpha,
455  const lapack_real& beta,
456  LAP_DoubleVector& Y) const {
457  //get the dimenson of Matrix
459 
460  tLVectorIndex nX=X.getSize();
461 
462  //verify the dimension of X
463  if (nX!=nRows) {
464  throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of X vector");
465  }
466 
467  //set the dimension of Y is beta=0
468  if (beta==0) {
469  Y.setSize(nRows);
470  }
471  tLVectorIndex nY=Y.getSize();
472  if (nY!=nRows) {
473  throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of Y vector");
474  }
475  //make the product
476  vectorProduct(nX,X.getIncrement(),&X(0),
477  alpha,
478  beta,
479  nY,Y.getIncrement(),&Y(0));
480  };
481 
482 
483 public:
494  virtual void vectorProduct(const tBoolean& isTrans,
495  const tLVectorIndex& nX,const tLVectorIncrement& incX,const double *X,
496  const lapack_real& alpha, const lapack_real& beta,
497  const tLVectorIndex& nY,const tLVectorIncrement& incY,double *Y) const {
498  vectorProduct(nX,incX,X,alpha,beta,nY,incY,Y);
499  }
500 
513  virtual void vectorProduct(const tLVectorIndex& nx,const tLVectorIncrement& incx,const double* x,
514  const lapack_real& alpha,
515  const lapack_real& beta,
516  const tLVectorIndex& ny,const tLVectorIncrement&incy,double* y) const {
517  if (getRowIncrement()!=1) {
518  cout <<"WARNING:row increment matrix ignored in lapack functions. It is set to 1. \n";
519  }
522  if (nRows==0) return;
523  if (nRows!=nx) {
524  throw LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::product","incompatible size of X vector");
525  }
526  if (nRows!=ny) {
527  throw LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::product","incompatible size of Y vector");
528  }
529  if (x==y) {
530  throw LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::product","x & y must have different pointer");
531  }
532 
534  nRows,
535  ld,
536  &(*this)(0,0),
537  alpha,beta,
538  ny,incy,y);
539  }
540 
541 
542 
543 
544 public:
549  virtual void dotProduct(const LAP_DoubleVector& v) {
550  dotProduct(1,v);
551  };
556  virtual void dotProduct(const double& alpha,const LAP_DoubleVector& X) {
557  //A is considered to be of size 1 x Nx : X is the first row
558  tLVectorIndex nRows=X.getSize();
559  setSize(nRows);
560 
562  alpha,//alpha
563  nRows,getLeadingDimension(),&(*this)(0,0));
564 
565  }
569  rankSymmetricProduct(1.,0.,false,A);
570  }
573  void rankSymmetricProduct(const double& alpha,const tBoolean& isTrans,const LAP_DoubleFullGeneralMatrix& A) {
574  rankSymmetricProduct(alpha,0,isTrans,A);
575  }
576 
581  virtual void rankSymmetricProduct(const double& alpha,const double& beta,const tBoolean& isTrans,const LAP_DoubleFullGeneralMatrix& A) {
582  //A is considered to be of size 1 x Nx : X is the first row
583  tLVectorIndex nARows=A.getRowsNumber();
584  tLVectorIndex nACols=A.getColumnsNumber();
586  const tLVectorIncrement &incA=A.getRowIncrement();
587  if (nARows*nACols==0) return;
588  rankSymmetricProduct(alpha,beta,nARows,nACols,incA,ldA,isTrans,&A(0,0));
589 
590  }
591 
596  virtual void rankSymmetricProduct(const double& alpha,const double& beta,
597  const tLVectorIndex& nARows,const tLVectorIndex& nACols,const tLVectorIncrement& incA,const tLVectorIndex& ldA,
598  const tBoolean& isTransA,const double* A) {
599  if (alpha==0) {
600  (*this)*=beta;
601  return;
602  }
603  tLVectorIndex nRows=nARows;
604  tLVectorIndex nCols=nACols;
605  if (isTransA) std::swap(nRows,nCols);
606  if (beta==0) {
607  setSize(nRows);
608  } else {
609  if (getRowsNumber()!=nRows) {
610  throw LAP_Exception("math/linalg/core",
611  "LAP_DoubleFullSymmetricMatrix::rankSymmetricProduct",
612  "matrices size incompatible");
613  }
614  }
615 
616  DoubleFullSymmetricMatrixKRankSymmetricProduct(nARows,nACols,incA,ldA,isTransA,A,
617  alpha,beta,
618  0,0,null,
619  nRows,getRowIncrement(),getLeadingDimension(),&(*this)(0,0));
620  }
621 
625  rankSymmetricProduct(D,1.,0.,false,A);
626  }
629  void rankSymmetricProduct(const LAP_DoubleVector& D,const double& alpha,const tBoolean& isTrans,const LAP_DoubleFullGeneralMatrix& A) {
630  rankSymmetricProduct(D,alpha,0,isTrans,A);
631  }
632 
637  virtual void rankSymmetricProduct(const LAP_DoubleVector& D,const double& alpha,const double& beta,const tBoolean& isTrans,const LAP_DoubleFullGeneralMatrix& A) {
638  if (alpha==0) {
639  (*this)*=beta;
640  return;
641  }
642  //A is considered to be of size 1 x Nx : X is the first row
643  tLVectorIndex nRows=A.getRowsNumber();
645  if (nRows*nCols==0) return;
646 
647  if (isTrans) std::swap(nRows,nCols);
648  if (beta==0) {
649  setSize(nRows);
650  } else {
651  if (getRowsNumber()!=nRows) {
652  throw LAP_Exception("math/linalg/core",
653  "LAP_DoubleFullSymmetricMatrix::rankSymmetricProduct",
654  "matrices size incompatible");
655  }
656  }
657  if (nCols!=D.getSize()) {
658  throw LAP_Exception("math/linalg/core",
659  "LAP_DoubleFullSymmetricMatrix::rankSymmetricProduct",
660  "matrix & diagonal have incompatible size");
661  }
663  A.getRowIncrement(),A.getLeadingDimension(),isTrans,&A(0,0),
664  alpha,beta,
665  D.getSize(),D.getIncrement(),&D(0),
666  nRows,getRowIncrement(),getLeadingDimension(),&(*this)(0,0));
667  }
668 
669 
670 
671 
672 
673 
674  // ----------------
675  // matrix product
676  // ----------------
679  virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix& B) const {
680  SP::LAP_DoubleFullGeneralMatrix C=LAP_DoubleFullGeneralMatrix::New();
681 
682  const LAP_DoubleFullSymmetricMatrix* dsyM=dynamic_cast<const LAP_DoubleFullSymmetricMatrix*>(&B);
683  if (dsyM!=null) {
684  matrixProduct(*dsyM,*C.get());
685  return C;
686  }
687 
688 
689  const LAP_DoubleFullGeneralMatrix* dgeM=dynamic_cast<const LAP_DoubleFullGeneralMatrix*>(&B);
690  if (dgeM!=null) {
691  matrixProduct(*dgeM,*C.get());
692  return C;
693  }
694 
695  return C;
696  };
697 
698 
702  LAP_DoubleFullGeneralMatrix& C) const {
703 
705  matrixProduct(true,(*this),B,1.0,0,C);
706  };
710  LAP_DoubleFullGeneralMatrix& C) const {
711 
713  matrixProduct(true,(*this),B,1.0,0,C);
714  };
718  const lapack_real& alpha,
719  const lapack_real& beta,
720  LAP_DoubleFullGeneralMatrix& C) const {
721  matrixProduct(true,(*this),B,alpha,beta,C);
722  };
723 
728  virtual void matrixProduct(const tBoolean& leftSide,
730  const lapack_real& alpha,
731  const lapack_real& beta,
732  LAP_DoubleFullGeneralMatrix& C) const {
733 
734  matrixProduct(leftSide,*this,B,alpha,beta,C);
735 
736 
737  }
750  virtual void matrixProduct(const tBoolean& leftSide,
751  const tLVectorIndex& nBRows,
752  const tLVectorIndex& nBCols,
753  const tLVectorIncrement& incB,
754  const tLVectorIndex& ldB,
755  const double* B,
756  const lapack_real& alpha,
757  const lapack_real& beta,
758  LAP_DoubleFullGeneralMatrix& C) const {
759  ASSERT_IN(B!=&C(0,0));
760 
761  //verify the dimension
763 
764  tLVectorIndex M=nBRows;
765  tLVectorIndex P=nBCols;
766  if (!leftSide) std::swap(M,P);
767 
768  if (N!=M) throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of matrix");
769  if (beta==0) {
770  if (leftSide) C.setSize(N,P);
771  else C.setSize(P,N);
772  } else {
773  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
774  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
775  }
776 
777  if (nBRows!=nBCols) throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of matrix");
778  if (beta==0) {
779  if (leftSide) C.setSize(N,P);
780  else C.setSize(P,N);
781  } else {
782  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
783  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
784  }
786  getRowsNumber(),getLeadingDimension(),&(*this)(0,0),//S
787  nBRows,nBCols,ldB,false,B,//B
788  alpha,beta,
790  }
791 
797  static void matrixProduct(const tBoolean& leftSide,
800  const lapack_real& alpha,
801  const lapack_real& beta,
803 
804  ASSERT_IN(&B!=&C);
805  //verify the dimension
809  if (!leftSide) std::swap(M,P);
810 
811  if (N!=M) throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of matrix");
812  if (beta==0) {
813  if (leftSide) C.setSize(N,P);
814  else C.setSize(P,N);
815  } else {
816  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
817  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
818  }
820  S.getRowsNumber(),S.getLeadingDimension(),&S(0,0),//S
821  B.getRowsNumber(),B.getColumnsNumber(),B.getLeadingDimension(),false,&B(0,0),//B
822  alpha,beta,
824 
825  }
826 
832  static void matrixProduct(const tBoolean& leftSide,
835  const lapack_real& alpha,
836  const lapack_real& beta,
837  LAP_DoubleFullGeneralMatrix& C) { //verify the dimension
841  if (!leftSide) std::swap(M,P);
842 
843  if (N!=M) throw LAP_Exception("math/linalg/core","LAP_DoubleFullSymmetricMatrix::product()","incompatible size of matrix");
844  if (beta==0) {
845  if (leftSide) C.setSize(N,P);
846  else C.setSize(P,N);
847  } else {
848  if (leftSide && ((C.getRowsNumber()!=N) || (C.getColumnsNumber()!=P))) C.setSize(N,P);
849  else if (!leftSide && ((C.getRowsNumber()!=P) || (C.getColumnsNumber()!=N))) C.setSize(P,N);
850  }
852  S1.getRowsNumber(),S1.getLeadingDimension(),&S1(0,0),//S1
853  S2.getRowsNumber(),S2.getColumnsNumber(),S2.getRowsNumber(),true,&S2(0,0),//S2
854  alpha,beta,
856  }
857 
858 
859 
860 
861  // ----------------------
862  // eigen values & vectors
863  // ------------------------
864 public:
865 
870  tLVectorIndex nRows=A.getRowsNumber();
872  // The leading dimension of the array A.
874 
875  if (nRows>nCols)
876  throw LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::computeEigenValues","matrix columns number must be greater than its rows number");
877  if ( A.getRowIncrement() != 1 )
878  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::computeEigenValues","matrix is non-contiguous."));
879 
880  U.resetView();
881  U.setSize(nRows);
882 
883  return DoubleFullSymmetricMatrixEigenValues(nRows,nCols,lda,&A(0,0),nRows,&U(0),false);
884 
885  }
886 
891  return computeEigenValues(C,U);
892  };
893 
894 private:
900  static tBoolean computeEigenValueDecomposition(LAP_DoubleFullSymmetricMatrix&A,
901  LAP_DoubleVector& U) {
902  tLVectorIndex nRows=A.getRowsNumber();
904  // The leading dimension of the array A.
906 
907  if (nRows>nCols)
908  throw LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::computeEigenValuesDecomposition","matrix columns number must be greater than its rows number");
909  if ( A.getRowIncrement() != 1 )
910  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::computeEigenValuesDecomposition","matrix is non-contiguous."));
911 
912  U.resetView();
913  U.setSize(nRows);
914 
915  return DoubleFullSymmetricMatrixEigenValues(nRows,nCols,lda,&A(0,0),nRows,&U(0),true);
916  }
917 public:
924  return computeEigenValueDecomposition(*this,U);
925  };
926 
935  SA.copy(*this);
936  tBoolean succeeds=computeEigenValueDecomposition(SA,U);
937  // SA is changed into eigen vector matrix
938  // get its values
939  SP::LAP_DoubleVector v;
941  // transert it in VP matrix
943  // SA is deleted
944  return succeeds;
945  }
946 
947 
954  LAP_DoubleVector& U,
956  // compute the eigen values U & vectors in VR
957  tBoolean succeeds=A.computeEigenValueDecomposition(U);
958  SP::LAP_DoubleVector v;
960  // transfert it in VP matrix
961  VR.setValues(A.getRowsNumber(),A.getRowsNumber(),v);
962  return succeeds;
963  };
964 public:
965 
966 
972  LAP_DoubleMatrix& VR) const {
974  if (fVR!=null) {
976  SA.copy(*this);
977  return computeEigenValueDecomposition(SA,U,*fVR);
978  } else {
979  return false;
980  }
981  };
982 
983 
990  const int& il,const int& iu) const {
992  return computeEigenValueDecomposition(C,U,VR,il,iu);
993  };
1004  LAP_DoubleVector& U,
1006  const lapack_int &il,const lapack_int& ul) {
1007  tLVectorIndex nRows=A.getRowsNumber();
1008  tLVectorIndex nCols=A.getColumnsNumber();
1009  // The leading dimension of the array A.
1010  lapack_int lda = A.getLeadingDimension();
1011 
1012  if (nRows>nCols)
1013  throw LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::computeEigenDecomposition","matrix columns number must be greater than its rows number");
1014  if ( A.getRowIncrement() != 1 )
1015  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::computeEigenDecomposition","matrix is non-contiguous."));
1016 
1017  //eigen values
1018  int nEigens=ul-il+1;
1019  U.resetView();
1020  U.setSize(nEigens);
1021 
1022  //eigen vectors
1023  Z.setSize(nRows,nEigens);
1024  lapack_int ldz = Z.getLeadingDimension();
1025 
1026  return DoubleFullSymmetricMatrixBoundedEigenValues(nRows,nCols,lda,&A(0,0),//A
1027  nEigens,&U(0),
1028  true,il,ul,0,0,ldz,&Z(0,0));
1029  }
1030 
1031  // -----------------------
1032  // linear system solver
1033  // -----------------------
1038  return inverse(*this);
1039  };
1040 
1041 public:
1042 
1047  if ( A.getRowIncrement() != 1 )
1048  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::inverseMatrix","matrix is non-contiguous."));
1049  tLVectorIndex nRows=A.getRowsNumber();
1050  LAP_IntegerVector ipiv;
1051  ipiv.setSize(nRows);
1052  if (BunchKaufmanFactorization(A,ipiv))
1053  return DoubleFullSymmetricMatrixInverse(nRows,A.getLeadingDimension(),&A(0,0),&ipiv(0));
1054  return false;
1055  };
1060  if ( A.getRowIncrement() != 1 )
1061  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::inverseMatrix","matrix is non-contiguous."));
1062  return DoubleFullSymmetricMatrixInverse(A.getRowsNumber(),A.getLeadingDimension(),&A(0,0),&ipiv(0));
1063  };
1064 
1065  // Transformation
1066  // ==============
1067 private:
1071  static SP::LAP_DoubleFullUpperMatrix choleskyFactorization(LAP_DoubleFullSymmetricMatrix& A) {
1072  if ( A.getRowIncrement() != 1 )
1073  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::choleskyFactorization","matrix is non-contiguous."));
1074  tLVectorIndex nRows=A.getRowsNumber();
1076  SP::LAP_DoubleFullUpperMatrix U=LAP_DoubleFullUpperMatrix::New();
1077  SP::LAP_DoubleVector vs;
1078  A.getStorage().getValuesPointer(vs);
1079  if (succeeds) U->setValues(vs);
1080  return U;
1081  }
1085  static tBoolean BunchKaufmanFactorization(LAP_DoubleFullSymmetricMatrix& A,LAP_IntegerVector& ipiv) {
1086  if ( A.getRowIncrement() != 1 )
1087  throw(LAP_Exception("math/linal/core","LAP_DoubleFullSymmetricMatrix::BunchKaufmanFactorization","matrix is non-contiguous."));
1088  tLVectorIndex nRows=A.getRowsNumber();
1089  ipiv.setSize(nRows);
1091  return succeeds;
1092 
1093  }
1094 public:
1095 
1099  virtual SP::LAP_DoubleUpperMatrix choleskyFactorization() {
1101  }
1106 
1107  return LAP_DoubleFullSymmetricMatrix::BunchKaufmanFactorization(*this,ipiv);
1108  }
1109 
1110 
1111 };
1112 #endif
tLVectorIndex getRowIncrement() const
get the memory distance between (*this)(i,j) & (*this)(i+1,j)
Definition: LAP_DoubleFullSymmetricMatrix.h:296
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_DoubleFullSymmetricMatrix.h:513
tBoolean DoubleFullSymmetricMatrixEigenValues(const tLVectorIndex &nRowsA, const tLVectorIndex &nColsA, const tLVectorIndex &ldA, double *A, const tLVectorIndex &nU, double *U, const tBoolean &areEigenVectorComputed)
compute the eigen values of the matrix A in U and store in A the eigen bvectors if areEigneVectorComp...
Definition: dfullsymmatrix_functions.cpp:631
virtual void setValues(SP::LAP_DoubleVector v)
set the values of the matrix to V without allocation the values array
Definition: LAP_DoubleFullSymmetricMatrix.h:256
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullSymmetricMatrix.h:311
this class describes the exceptions raised for LAP package
Definition: LAP_Exception.h:14
LAP_DoubleFullSymmetricMatrix & operator-=(const lapack_real &s)
sub s to the upper matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:170
LAP_DoubleMatrixStorage & getStorage()
set the storage
Definition: LAP_DoubleMatrix.h:179
this class describes a full symmetric matrix for lapack used
Definition: LAP_DoubleFullSymmetricMatrix.h:31
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_DoubleFullSymmetricMatrix.h:320
static SP::LAP_DoubleFullGeneralMatrix New()
Definition: LAP_DoubleFullGeneralMatrix.h:78
double get(const tLVectorIndex &i, const tLVectorIndex &j) const
get the value taking into account the view
Definition: LAP_DoubleMatrix.h:172
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_DoubleFullSymmetricMatrix.h:453
this class describes a general double symmetric matrix
Definition: LAP_DoubleSymmetricMatrix.h:21
LAP_DoubleFullSymmetricMatrix & operator*=(const LAP_DoubleFullSymmetricMatrix &s)
multiply the viewed matrices term by term
Definition: LAP_DoubleFullSymmetricMatrix.h:180
DEFINE_SPTR(LAP_DoubleFullSymmetricMatrix)
LAP_DoubleFullSymmetricMatrix()
build a matrix
Definition: LAP_DoubleFullSymmetricMatrix.cpp:13
virtual tBoolean BunchKaufmanFactorization(LAP_IntegerVector &ipiv)
compute the Bunch Kaufman factorization of the full symmetric matrix A is modified such that the uppe...
Definition: LAP_DoubleFullSymmetricMatrix.h:1105
virtual void dotProduct(const LAP_DoubleVector &v)
compute the symmetric matrix S= X.tX only the upper symmetric matric is set. (lapack method dsyr call...
Definition: LAP_DoubleFullSymmetricMatrix.h:549
void matrixProduct(const LAP_DoubleFullSymmetricMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoubleFullSymmetricMatrix.h:701
Definition: LAP_IntegerVector.h:18
tLVectorIncrement getRowIncrement() const
get the memory distance between (*this)(i,j) & (*this)(i+1,j)
Definition: LAP_DoubleFullGeneralMatrix.h:346
virtual void setValues(const tLVectorIndex &n, const double *values)
set the values
Definition: LAP_DoubleFullSymmetricMatrix.h:271
void indexMin(tLVectorIndex &i, tLVectorIndex &j) const
get the index of the min view element in absolute value
Definition: LAP_DoubleFullSymmetricMatrix.cpp:360
static tBoolean computeEigenValues(LAP_DoubleFullSymmetricMatrix &A, LAP_DoubleVector &U)
compute the eigen values of A in ascending order and A is destroyed after method lapack method dsyev ...
Definition: LAP_DoubleFullSymmetricMatrix.h:869
LAP_DoubleFullSymmetricMatrix & operator=(const LAP_DoubleFullSymmetricMatrix &s)
init all the matrix to s
Definition: LAP_DoubleFullSymmetricMatrix.h:132
virtual tBoolean copy(const LAP_DoubleMatrix &x)
copy a matrix
Definition: LAP_DoubleMatrix.cpp:18
void matrixProduct(const LAP_DoubleFullGeneralMatrix &B, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B
Definition: LAP_DoubleFullSymmetricMatrix.h:709
void DoubleFullSymmetricMatrixKRankSymmetricProduct(const tLVectorIndex &nRowAs, const tLVectorIndex &nColsA, const tLVectorIncrement &incA, const tLVectorIndex &ldA, const tBoolean &isTransA, const double *A, const double &alpha, const double &beta, const tLVectorIndex &nD, const tLVectorIncrement &incD, const double *D, const tLVectorIndex &nS, const tLVectorIncrement &incS, const tLVectorIndex &ldS, double *S)
compute the symmetric matrix S:= beta.S+alpha* A. tA or S=beta.S+alpha tA . A
Definition: dfullsymmatrix_functions.cpp:491
tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U)
compute the eigen elements in ascending order of This the eigen vectors are set in This: This is dest...
Definition: LAP_DoubleFullSymmetricMatrix.h:923
Definition: LAP_DoubleVector.h:20
#define lapack_int
Definition: lapack_functions.h:7
virtual tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U, LAP_DoubleMatrix &VR) const
compute the eigen values decomposition in acending order on This
Definition: LAP_DoubleFullSymmetricMatrix.h:971
Definition: LAP_DoubleMatrix.h:18
virtual tReal norm2() const
return norm2 sqrt(sum_ij(aij^2))=sqrt(tr(AtA));
Definition: LAP_DoubleFullSymmetricMatrix.cpp:227
void rankSymmetricProduct(const LAP_DoubleVector &D, const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix S:=alpha op(A).t(op(A))
Definition: LAP_DoubleFullSymmetricMatrix.h:624
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 void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix n x p
Definition: LAP_Matrix.h:87
virtual void getRow(const tLVectorIndex &i, LAP_DoubleVector &v) const
get the i-th row in a vector
Definition: LAP_DoubleFullSymmetricMatrix.cpp:83
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_ConstVector.h:170
virtual tLVectorIndex getViewedRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullStorage.h:285
static tBoolean inverse(LAP_DoubleFullSymmetricMatrix &A, const LAP_IntegerVector &ipiv)
inverse a symmetric matrix dsytrf & dsytri lapack methods called
Definition: LAP_DoubleFullSymmetricMatrix.h:1059
LAP_DoubleFullStorage & getFullStorage()
GET.
Definition: LAP_DoubleFullSymmetricMatrix.h:284
LAP_DoubleFullSymmetricMatrix & operator+=(const lapack_real &s)
add s to the upper matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:162
virtual SP::LAP_DoubleMatrix matrixProduct(const LAP_DoubleMatrix &B) const
return C=(This) . B
Definition: LAP_DoubleFullSymmetricMatrix.h:679
tBoolean DoubleFullSymmetricMatrixCholeskyFactorization(const tLVectorIndex &nRowsA, const tLVectorIndex &ldA, double *A)
Definition: dfullsymmatrix_functions.cpp:921
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_DoubleFullSymmetricMatrix.h:494
#define tBoolean
Definition: types.h:48
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix and allocate the values array
Definition: LAP_DoubleFullGeneralMatrix.h:230
#define lapack_real
Definition: lapack_functions.h:9
LAP_DoubleFullSymmetricMatrix & operator/=(const lapack_real &s)
divide by s the matrix v
Definition: LAP_DoubleFullSymmetricMatrix.h:155
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_DoubleFullSymmetricMatrix.cpp:261
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:366
static SP::LAP_DoubleFullUpperMatrix New()
Definition: LAP_DoubleFullUpperMatrix.h:63
tBoolean inverse()
inverse the matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:1037
virtual tBoolean computeEigenValues(LAP_DoubleVector &U) const
compute the eigen values of This: A is copied in ascending order
Definition: LAP_DoubleFullSymmetricMatrix.h:889
virtual SP::LAP_DoubleMatrix NewInstance() const
create a New instance of this
Definition: LAP_DoubleFullSymmetricMatrix.h:96
#define null
Definition: types.h:13
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_Vector.h:529
static void matrixProduct(const tBoolean &leftSide, const LAP_DoubleFullSymmetricMatrix &S, const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C)
make the product C = alpha. S . B +beta C if leftSide=true C = alpha. B . S +beta C if leftSide=false...
Definition: LAP_DoubleFullSymmetricMatrix.h:797
void rankSymmetricProduct(const LAP_DoubleVector &D, const double &alpha, const tBoolean &isTrans, const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix S:=alpha op(A).t(op(A))
Definition: LAP_DoubleFullSymmetricMatrix.h:629
virtual void rankSymmetricProduct(const double &alpha, const double &beta, const tBoolean &isTrans, const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix S:=beta.S+ alpha op(A).t(op(A)) only the upper symmetric matric is set...
Definition: LAP_DoubleFullSymmetricMatrix.h:581
tBoolean computeEigenValueDecomposition(LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &VR) const
compute the eigen values in ascending order decomposition on this:
Definition: LAP_DoubleFullSymmetricMatrix.h:933
tBoolean DoubleFullSymmetricMatrixBunchKaufmanFactorization(const tLVectorIndex &nRows, const tLVectorIndex &ldA, double *A, lapack_int *ipiv)
Definition: dfullsymmatrix_functions.cpp:986
virtual void getRow(const tLVectorIndex &i, SP::LAP_DoubleVector v) const
get the i-th row in a vector
Definition: LAP_DoubleFullSymmetricMatrix.h:343
static tBoolean computeEigenValueDecomposition(LAP_DoubleFullSymmetricMatrix &A, LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &Z, 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_DoubleFullSymmetricMatrix.h:1003
void init(const double &v)
init the values
Definition: LAP_DoubleMatrixStorage.h:124
LAP_DoubleFullSymmetricMatrix & operator+=(const LAP_DoubleFullSymmetricMatrix &s)
add the viewed matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:199
virtual void setSize(const tLVectorIndex &n)
set the dimension of the matrix and alocate the values array
Definition: LAP_DoubleFullSymmetricMatrix.h:247
virtual tLVectorIndex getRowsNumber() const
get the lines number of the matrix from view
Definition: LAP_DoubleFullSymmetricMatrix.h:306
virtual void setValues(const tLVectorIndex &n, const double *values)
copy the values to the matrix values
Definition: LAP_DoubleFullStorage.h:195
tBoolean DoubleFullSymmetricMatrixInverse(const tLVectorIndex &nRows, const tLVectorIndex &ldA, double *A, const lapack_int *ipiv)
Definition: dfullsymmatrix_functions.cpp:1077
Definition: LAP_DoubleFullGeneralMatrix.h:30
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_DoubleFullSymmetricMatrix.h:107
static SP::LAP_DoubleFullSymmetricMatrix Identity(const tLVectorIndex &nRows)
create an identity matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:81
tLVectorIndex getSize() const
get the size of the vector
Definition: LAP_Vector.h:519
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_DoubleFullSymmetricMatrix.h:114
virtual void getValuesPointer(SP::LAP_DoubleVector &v)
Definition: LAP_DoubleMatrixStorage.h:208
void rankSymmetricProduct(const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix S:=alpha op(A).t(op(A))
Definition: LAP_DoubleFullSymmetricMatrix.h:568
virtual void vectorProduct(const LAP_DoubleVector &X, LAP_DoubleVector &Y)
compute Y=A.X
Definition: LAP_DoubleFullSymmetricMatrix.h:408
static SP::LAP_DoubleFullSymmetricMatrix New()
Definition: LAP_DoubleFullSymmetricMatrix.h:66
virtual void setValuesNumber(const tLVectorIndex &nRows, const tLVectorIndex &n)
set the values number
Definition: LAP_DoubleFullStorage.h:213
virtual void setSize(const tLVectorIndex &n, const tLVectorIndex &p)
set the dimension of the matrix and allocate the values array
Definition: LAP_DoubleFullSymmetricMatrix.h:231
virtual tLVectorIndex getViewedColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullStorage.h:290
virtual void rankSymmetricProduct(const LAP_DoubleVector &D, const double &alpha, const double &beta, const tBoolean &isTrans, const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix S:=beta.S+ alpha op(A).t(op(A)) only the upper symmetric matric is set...
Definition: LAP_DoubleFullSymmetricMatrix.h:637
LAP_DoubleFullSymmetricMatrix & operator*=(const lapack_real &s)
multiply by s the matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:149
virtual void dotProduct(const double &alpha, const LAP_DoubleVector &X)
compute the symmetric matrix S:= alpha X.tX only the upper symmetric matric is set. (lapack method dsyr called)
Definition: LAP_DoubleFullSymmetricMatrix.h:556
Definition: LAP_DoubleFullStorage.h:29
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_DoubleFullSymmetricMatrix.cpp:330
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_DoubleFullSymmetricMatrix.h:988
void getColumnByReference(const tLVectorIndex &j, LAP_DoubleVector &v)
get the column by reference the values of v pointer to the values of the column j of this ...
Definition: LAP_DoubleFullSymmetricMatrix.h:328
const LAP_DoubleFullStorage & getFullStorage() const
get the full storage
Definition: LAP_DoubleFullSymmetricMatrix.h:289
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_DoubleFullSymmetricMatrix.h:750
void DoubleFullSymmetricMatrixRankSymmetricProduct(const tLVectorIncrement &incX, const double *X, const double &alpha, const tLVectorIndex &nS, const tLVectorIndex &ldS, double *S)
compute the symmetric matrix S+=alpha X tX
Definition: dfullsymmatrix_functions.cpp:414
#define tLVectorIndex
Definition: lapack_types.h:13
this class describes a packed symmetric matrix for lapack used where values are stored in vector: {A(...
Definition: LAP_DoublePackedSymmetricMatrix.h:31
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_DoubleFullSymmetricMatrix.h:418
tLVectorIndex getLeadingDimension() const
get the memory distance between (*this)(i,j) & (*this)(i,j+1)
Definition: LAP_DoubleFullSymmetricMatrix.h:301
const tLVectorIncrement & getIncrement() const
get the increment of the vector
Definition: LAP_ConstVector.h:175
virtual void getColumn(const tLVectorIndex &j, LAP_DoubleVector &v) const
get the j-th column of this symmetric matrix in a vector
Definition: LAP_DoubleFullSymmetricMatrix.cpp:126
LAP_DoubleFullSymmetricMatrix & operator^=(const lapack_real &s)
power by s the matrix v
Definition: LAP_DoubleFullSymmetricMatrix.h:142
void getColumnByReference(const tLVectorIndex &j, LAP_ConstDoubleVector &v) const
get the column by reference the values of v pointer to the values of the column j of this ...
Definition: LAP_DoubleFullSymmetricMatrix.h:334
tLVectorIndex getLeadingDimension() const
get the memory distance between (*this)(i,j) & (*this)(i,j+1)
Definition: LAP_DoubleFullGeneralMatrix.h:351
LAP_DoubleFullSymmetricMatrix & operator/=(const LAP_DoubleFullSymmetricMatrix &s)
divide the viewed matrices term by term
Definition: LAP_DoubleFullSymmetricMatrix.h:186
static tBoolean computeEigenValueDecomposition(LAP_DoubleFullSymmetricMatrix &A, LAP_DoubleVector &U, LAP_DoubleFullGeneralMatrix &VR)
compute the eigen elements of A in ascedning order the eigen vectors are set in A: A is destroyed IN ...
Definition: LAP_DoubleFullSymmetricMatrix.h:953
virtual ~LAP_DoubleFullSymmetricMatrix()
destroy a matrix
Definition: LAP_DoubleFullSymmetricMatrix.cpp:27
virtual tLVectorIndex getColumnsNumber() const
get the columns number of the matrix from view
Definition: LAP_DoubleFullGeneralMatrix.h:371
Definition: CORE_Pointers.h:51
void rankSymmetricProduct(const double &alpha, const tBoolean &isTrans, const LAP_DoubleFullGeneralMatrix &A)
compute the symmetric matrix S:=alpha op(A).t(op(A))
Definition: LAP_DoubleFullSymmetricMatrix.h:573
virtual void setValuesPointer(SP::LAP_DoubleVector v)
set the values of without copying
Definition: LAP_DoubleFullStorage.h:180
LAP_DoubleFullSymmetricMatrix & operator=(const double &s)
init all the matrix to s
Definition: LAP_DoubleFullSymmetricMatrix.h:126
void DoubleFullSymmetricMatrixMatrixProduct(const tBoolean &isLeftSide, const tLVectorIndex &nRowsA, const tLVectorIndex &ldA, const double *A, const tLVectorIndex &nRowsB, const tLVectorIndex &nColsB, const tLVectorIndex &ldB, const tBoolean &isBSymmetric, const double *B, const lapack_real &alpha, const lapack_real &beta, const tLVectorIndex &nRowsC, const tLVectorIndex &nColsC, const tLVectorIndex &ldC, double *C)
compute matric matrix product
Definition: dfullsymmatrix_functions.cpp:258
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 C = alpha. This . B +beta C if leftSide=true C = alpha. B . This +beta C if leftSide...
Definition: LAP_DoubleFullSymmetricMatrix.h:728
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_DoubleFullGeneralMatrix.h:254
virtual void rankSymmetricProduct(const double &alpha, const double &beta, const tLVectorIndex &nARows, const tLVectorIndex &nACols, const tLVectorIncrement &incA, const tLVectorIndex &ldA, const tBoolean &isTransA, const double *A)
compute the symmetric matrix S:=beta.S+ alpha op(A).t(op(A)) only the upper symmetric matric is set...
Definition: LAP_DoubleFullSymmetricMatrix.h:596
void copyUpperToLowerSubMatrix()
copy the upper part to the lower part of the matrix
Definition: LAP_DoubleFullSymmetricMatrix.cpp:31
virtual void getColumnByReference(const tLVectorIndex &j, LAP_DoubleVector &v)
get the column by reference the values of v pointer to the values of the column j of this ...
Definition: LAP_DoubleFullStorage.cpp:1097
static void matrixProduct(const tBoolean &leftSide, const LAP_DoubleFullSymmetricMatrix &S1, const LAP_DoubleFullSymmetricMatrix &S2, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C)
make the product C = alpha. S1 . S2 +beta C if leftSide=true C = alpha. S2 . S1 +beta C if leftSide=f...
Definition: LAP_DoubleFullSymmetricMatrix.h:832
static SP::LAP_DoubleFullSymmetricMatrix New(const tLVectorIndex &n)
Definition: LAP_DoubleFullSymmetricMatrix.h:73
virtual SP::LAP_DoubleUpperMatrix choleskyFactorization()
compute the choleskey factorization of the full symmetric matrix A is modified such that the upper ma...
Definition: LAP_DoubleFullSymmetricMatrix.h:1099
#define tLVectorIncrement
Definition: lapack_types.h:16
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
#define tReal
Definition: types.h:18
virtual void matrixProduct(const LAP_DoubleFullGeneralMatrix &B, const lapack_real &alpha, const lapack_real &beta, LAP_DoubleFullGeneralMatrix &C) const
return C=(This) . B (lefside=true) or B. (this) (lefside=false)
Definition: LAP_DoubleFullSymmetricMatrix.h:717
virtual SP::LAP_DoubleVector vectorProduct(const LAP_DoubleVector &X) const
compute This. X
Definition: LAP_DoubleMatrix.h:328
LAP_DoubleFullSymmetricMatrix & operator-=(const LAP_DoubleFullSymmetricMatrix &s)
sub the viewed matrix
Definition: LAP_DoubleFullSymmetricMatrix.h:193
void resetView()
set the view of the vector to all the values
Definition: LAP_Vector.h:352
void DoubleFullSymmetricMatrixVectorProduct(const tLVectorIndex &nX, const tLVectorIncrement &incX, const double *x, const tLVectorIndex &nRows, const tLVectorIndex &ldA, 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: dfullsymmatrix_functions.cpp:162
static tBoolean inverse(LAP_DoubleFullSymmetricMatrix &A)
inverse a symmetric matrix dsytrf & dsytri lapack methods called
Definition: LAP_DoubleFullSymmetricMatrix.h:1046
tBoolean DoubleFullSymmetricMatrixBoundedEigenValues(const tLVectorIndex &nRowsA, const tLVectorIndex &nColsA, const tLVectorIndex &ldA, double *A, const tLVectorIndex &nU, double *U, const tBoolean &areEigenVectorComputed, const tLVectorIndex &minIndex, const tLVectorIndex &maxIndex, const double &minBound, const double &maxBound, const tLVectorIndex &ldZ, double *Z)
compute only selected eigen values of the matrix A in U and store in Z the eigen vectors if areEigneV...
Definition: dfullsymmatrix_functions.cpp:733
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