CPPLapack
 All Classes Files Functions Variables Friends
_dsymatrix-dgematrix.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! _dsymatrix+dgematrix operator */
00003 inline _dgematrix operator+(const _dsymatrix& matA, const dgematrix& matB)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(matA.n!=matB.n || matA.n!=matB.m){
00007     ERROR_REPORT;
00008     std::cerr << "These two matrises can not make a summation." << std::endl
00009               << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
00010     exit(1);
00011   }
00012 #endif//CPPL_DEBUG
00013   
00014   dgematrix newmat(matB);
00015   for(long i=0; i<matA.n; i++){
00016     for(long j=0; j<matA.n; j++ ){
00017       newmat(i,j)+=matA(i,j);
00018     }
00019   }
00020   
00021   matA.destroy();
00022   return _(newmat);
00023 }
00024 
00025 //=============================================================================
00026 /*! _dsymatrix-dgematrix operator */
00027 inline _dgematrix operator-(const _dsymatrix& matA, const dgematrix& matB)
00028 {VERBOSE_REPORT;
00029 #ifdef  CPPL_DEBUG
00030   if(matA.n!=matB.n || matA.n!=matB.m){
00031     ERROR_REPORT;
00032     std::cerr << "These two matrises can not make a subtraction." << std::endl
00033               << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
00034     exit(1);
00035   }
00036 #endif//CPPL_DEBUG
00037   
00038   dgematrix newmat(-matB);
00039   for(long i=0; i<matA.n; i++){
00040     for(long j=0; j<matA.n; j++ ){
00041       newmat(i,j)+=matA(i,j);
00042     }
00043   }
00044   
00045   matA.destroy();
00046   return _(newmat);
00047 }
00048 
00049 //=============================================================================
00050 /*! _dsymatrix*dgematrix operator */
00051 inline _dgematrix operator*(const _dsymatrix& matA, const dgematrix& matB)
00052 {VERBOSE_REPORT;
00053 #ifdef  CPPL_DEBUG
00054   if(matA.n!=matB.m){
00055     ERROR_REPORT;
00056     std::cerr << "These two matrises can not make a product." << std::endl
00057               << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
00058     exit(1);
00059   }
00060 #endif//CPPL_DEBUG
00061   
00062   dgematrix newmat( matA.n, matB.n );
00063   dsymm_( 'l', 'l', matA.n, matB.n, 1.0, matA.array, matA.n, 
00064           matB.array, matB.m, 0.0, newmat.array, newmat.m );
00065   
00066   matA.destroy();
00067   return _(newmat);
00068 }
 All Classes Files Functions Variables Friends