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