CPPLapack
 All Classes Files Functions Variables Friends
dssmatrix-_dssmatrix.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! dssmatrix=_dssmatrix operator */
00003 inline dssmatrix& dssmatrix::operator=(const _dssmatrix& mat)
00004 {VERBOSE_REPORT;
00005   shallow_copy(mat);
00006   return *this;
00007 }
00008 
00009 ///////////////////////////////////////////////////////////////////////////////
00010 ///////////////////////////////////////////////////////////////////////////////
00011 ///////////////////////////////////////////////////////////////////////////////
00012 
00013 //=============================================================================
00014 /*! dssmatrix+=_dssmatrix operator */
00015 inline dssmatrix& dssmatrix::operator+=(const _dssmatrix& mat)
00016 {VERBOSE_REPORT;
00017 #ifdef  CPPL_DEBUG
00018   if(n!=mat.n){
00019     ERROR_REPORT;
00020     std::cerr << "These two matrises can not make a summation." << std::endl
00021               << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl;
00022     exit(1);
00023   }
00024 #endif//CPPL_DEBUG
00025   
00026   for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00027     (*this)(it->i,it->j) +=it->v;
00028   }
00029   
00030   mat.destroy();
00031   return *this;
00032 }
00033 
00034 //=============================================================================
00035 /*! dssmatrix-=_dssmatrix operator */
00036 inline dssmatrix& dssmatrix::operator-=(const _dssmatrix& mat)
00037 {VERBOSE_REPORT;
00038 #ifdef  CPPL_DEBUG
00039   if(n!=mat.n){
00040     ERROR_REPORT;
00041     std::cerr << "These two matrises can not make a sutraction." << std::endl
00042               << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl;
00043     exit(1);
00044   }
00045 #endif//CPPL_DEBUG
00046   
00047   for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat.data.end(); it++){
00048     (*this)(it->i,it->j) -=it->v;
00049   }
00050   
00051   mat.destroy();
00052   return *this;
00053 }
00054 
00055 ///////////////////////////////////////////////////////////////////////////////
00056 ///////////////////////////////////////////////////////////////////////////////
00057 ///////////////////////////////////////////////////////////////////////////////
00058 
00059 //=============================================================================
00060 /*! dssmatrix+_dssmatrix operator */
00061 inline _dssmatrix operator+(const dssmatrix& matA, const _dssmatrix& matB)
00062 {VERBOSE_REPORT;
00063 #ifdef  CPPL_DEBUG
00064   if(matA.n!=matB.n){
00065     ERROR_REPORT;
00066     std::cerr << "These two matrises can not make a summation." << std::endl
00067               << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
00068     exit(1);
00069   }
00070 #endif//CPPL_DEBUG
00071 
00072   dssmatrix newmat(matB);
00073   
00074   for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
00075     newmat(it->i,it->j) +=it->v;
00076   }
00077   
00078   return _(newmat);
00079 }
00080 
00081 //=============================================================================
00082 /*! dssmatrix-_dssmatrix operator */
00083 inline _dssmatrix operator-(const dssmatrix& matA, const _dssmatrix& matB)
00084 {VERBOSE_REPORT;
00085 #ifdef  CPPL_DEBUG
00086   if(matA.n!=matB.n){
00087     ERROR_REPORT;
00088     std::cerr << "These two matrises can not make a subtraction." << std::endl
00089               << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
00090     exit(1);
00091   }
00092 #endif//CPPL_DEBUG
00093   
00094   dssmatrix newmat(matB);
00095   
00096   for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
00097     newmat(it->i,it->j) -=it->v;
00098   }
00099   
00100   return _(newmat);
00101 }
00102 
00103 //=============================================================================
00104 /*! dssmatrix*_dssmatrix operator */
00105 /*
00106 inline _dgsmatrix operator*(const dssmatrix& matA, const _dssmatrix& matB)
00107 {VERBOSE_REPORT;
00108 #ifdef  CPPL_DEBUG
00109   if(matA.n!=matB.n){
00110     ERROR_REPORT;
00111     std::cerr << "These two matrises can not make a product." << std::endl
00112               << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
00113     exit(1);
00114   }
00115 #endif//CPPL_DEBUG
00116 
00117   dssmatrix newmat( matA.n, 0 );
00118   
00119   for(long c=0; c<matA.vol; c++){
00120     long k(matA.jndx[c]);
00121     std::vector< std::pair<long,long> >::iterator p;
00122     for(p=matB.line[k].begin(); p!=matB.line[k].end(); p++){
00123       newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second];
00124     }
00125   }
00126   
00127   matB.destroy();
00128   return _(newmat);
00129 }
00130 */
 All Classes Files Functions Variables Friends