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   return _(newmat);
00022 }
00023 
00024 //=============================================================================
00025 /*! dsymatrix-dgematrix operator */
00026 inline _dgematrix operator-(const dsymatrix& matA, const dgematrix& matB)
00027 {VERBOSE_REPORT;
00028 #ifdef  CPPL_DEBUG
00029   if(matA.n!=matB.n || matA.n!=matB.m){
00030     ERROR_REPORT;
00031     std::cerr << "These two matrises can not make a summation." << std::endl
00032               << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
00033     exit(1);
00034   }
00035 #endif//CPPL_DEBUG
00036   
00037   dgematrix newmat(-matB);
00038   for(long i=0; i<matA.n; i++){
00039     for(long j=0; j<matA.n; j++){
00040       newmat(i,j)+=matA(i,j);
00041     }
00042   }
00043   
00044   return _(newmat);
00045 }
00046 
00047 
00048 //=============================================================================
00049 /*! dsymatrix*dgematrix operator */
00050 inline _dgematrix operator*(const dsymatrix& matA, const dgematrix& matB)
00051 {VERBOSE_REPORT;
00052 #ifdef  CPPL_DEBUG
00053   if(matA.n!=matB.m){
00054     ERROR_REPORT;
00055     std::cerr << "These two matrises can not make a product." << std::endl
00056               << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
00057     exit(1);
00058   }
00059 #endif//CPPL_DEBUG
00060 
00061   dgematrix newmat( matA.n, matB.n );
00062   dsymm_( 'l', 'l', matA.n, matB.n, 1.0, matA.array, matA.n,
00063           matB.array, matB.m, 0.0, newmat.array, newmat.m );
00064   
00065   return _(newmat);
00066 }
 All Classes Files Functions Variables Friends