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