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