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