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