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