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