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