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& zgematrix::operator+=(const _zhematrix& mat)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(n!=mat.n || m!=mat.n){
00007     ERROR_REPORT;
00008     std::cerr << "These two matrises can not make a summation." << std::endl
00009               << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl;
00010     exit(1);
00011   }
00012 #endif//CPPL_DEBUG
00013   
00014   for(long i=0; i<m; i++){ for(long j=0; j<n; j++){
00015     operator()(i,j) +=mat(i,j);
00016   }}
00017   
00018   mat.destroy();
00019   return *this;
00020 }
00021 
00022 //=============================================================================
00023 /*! zgematrix-=_zhematrix operator */
00024 inline zgematrix& zgematrix::operator-=(const _zhematrix& mat)
00025 {VERBOSE_REPORT;
00026 #ifdef  CPPL_DEBUG
00027   if(n!=mat.n || m!=mat.n){
00028     ERROR_REPORT;
00029     std::cerr << "These two matrises can not make a sutraction." << std::endl
00030               << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
00031     exit(1);
00032   }
00033 #endif//CPPL_DEBUG
00034   
00035   for(long i=0; i<m; i++){ for(long j=0; j<n; j++){
00036     operator()(i,j) -=mat(i,j);
00037   }}
00038   
00039   mat.destroy();
00040   return *this;
00041 }
00042 
00043 //=============================================================================
00044 /*! zgematrix*=_zhematrix operator */
00045 inline zgematrix& zgematrix::operator*=(const _zhematrix& mat)
00046 {VERBOSE_REPORT;
00047 #ifdef  CPPL_DEBUG
00048   if(n!=mat.n){
00049     ERROR_REPORT;
00050     std::cerr << "These two matrises can not make a product." << std::endl
00051               << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl;
00052     exit(1);
00053   }
00054 #endif//CPPL_DEBUG
00055   
00056   zgematrix newmat( m, mat.n );
00057   
00058   zhemm_( 'R', 'l', mat.n, n, comple(1.0,0.0), mat.array, mat.n, 
00059           array, m, comple(0.0,0.0), newmat.array, newmat.m );
00060   
00061   swap(*this,newmat);
00062   mat.destroy();
00063   return *this;
00064 }
00065 
00066 ///////////////////////////////////////////////////////////////////////////////
00067 ///////////////////////////////////////////////////////////////////////////////
00068 ///////////////////////////////////////////////////////////////////////////////
00069 
00070 //=============================================================================
00071 /*! zgematrix+_zhematrix operator */
00072 inline _zgematrix operator+(const zgematrix& matA, const _zhematrix& matB)
00073 {VERBOSE_REPORT;
00074 #ifdef  CPPL_DEBUG
00075   if(matA.n!=matB.n || matA.m!=matB.n){
00076     ERROR_REPORT;
00077     std::cerr << "These two matrises can not make a summation." << std::endl
00078               << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
00079     exit(1);
00080   }
00081 #endif//CPPL_DEBUG
00082   
00083   zgematrix newmat(matA);
00084   for(long i=0; i<matA.m; i++){ for(long j=0; j<matA.n; j++){
00085     newmat(i,j) +=matB(i,j);
00086   }}
00087   
00088   matB.destroy();
00089   return _(newmat);
00090 }
00091 
00092 //=============================================================================
00093 /*! zgematrix-_zhematrix operator */
00094 inline _zgematrix operator-(const zgematrix& matA, const _zhematrix& matB)
00095 {VERBOSE_REPORT;
00096 #ifdef  CPPL_DEBUG
00097   if(matA.n!=matB.n || matA.m!=matB.n){
00098     ERROR_REPORT;
00099     std::cerr << "These two matrises can not make a subtraction." << std::endl
00100               << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
00101     exit(1);
00102   }
00103 #endif//CPPL_DEBUG
00104   
00105   zgematrix newmat(matA);
00106   for(long i=0; i<matA.m; i++){ for(long j=0; j<matA.n; j++){
00107     newmat(i,j) -=matB(i,j);
00108   }}
00109   
00110   matB.destroy();
00111   return _(newmat);
00112 }
00113 
00114 //=============================================================================
00115 /*! zgematrix*_zhematrix operator */
00116 inline _zgematrix operator*(const zgematrix& matA, const _zhematrix& matB)
00117 {VERBOSE_REPORT;
00118 #ifdef  CPPL_DEBUG
00119   if(matA.n!=matB.n){
00120     ERROR_REPORT;
00121     std::cerr << "These two matrises can not make a product." << std::endl
00122               << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
00123     exit(1);
00124   }
00125 #endif//CPPL_DEBUG
00126   
00127   zgematrix newmat( matA.n, matB.n );
00128   
00129   zhemm_( 'R', 'l', matB.n, matA.n, comple(1.0,0.0), 
00130           matB.array, matB.n, matA.array, matA.m, 
00131           comple(0.0,0.0), newmat.array, newmat.m );
00132   
00133   matB.destroy();
00134   return _(newmat);
00135 }
 All Classes Files Functions Variables Friends