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