//=============================================================================
/*! _dssmatrix+dssmatrix operator */
inline _dssmatrix operator+(const _dssmatrix& matA, const dssmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator+(const _dssmatrix&, const dssmatrix&)" << std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.N){
std::cerr << "[ERROR] operator+(const _dssmatrix&, const dssmatrix&)" << std::endl
<< "These two matrises can not make a summation." << std::endl
<< "Your input was (" << matA.N << "x" << matA.N << ") + (" << matB.N << "x" << matB.N << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
dssmatrix newmat(matA);
for(std::vector<dcomponent>::const_iterator it=matB.Data.begin(); it!=matB.Data.end(); it++){
newmat(it->i,it->j) +=it->v;
}
return _(newmat);
}
//=============================================================================
/*! _dssmatrix-dssmatrix operator */
inline _dssmatrix operator-(const _dssmatrix& matA, const dssmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator-(const _dssmatrix&, const dssmatrix&)" << std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.N){
std::cerr << "[ERROR] operator-(const _dssmatrix&, const dssmatrix&)" << std::endl
<< "These two matrises can not make a subtraction." << std::endl
<< "Your input was (" << matA.N << "x" << matA.N << ") - (" << matB.N << "x" << matB.N << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
dssmatrix newmat(matA);
for(std::vector<dcomponent>::const_iterator it=matB.Data.begin(); it!=matB.Data.end(); it++){
newmat(it->i,it->j) -=it->v;
}
return _(newmat);
}
//=============================================================================
/*! _dssmatrix*dssmatrix operator */
/*
inline _dssmatrix operator*(const _dssmatrix& matA, const dssmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const _dssmatrix&, const dssmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.M){
std::cerr << "[ERROR] operator*(const _dssmatrix&, const dssmatrix&)"
<< std::endl
<< "These two matrises can not make a product." << std::endl
<< "Your input was (" << matA.M << "x" << matA.N << ") * ("
<< matB.M << "x" << matB.N << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
dssmatrix newmat( matA.M, matB.N, 0 );
for(long c=0; c<matA.VOL; c++){
long k(matA.Jndx[c]);
std::vector< std::pair<long,long> >::iterator p;
for(p=matB.Col[k].begin(); p!=matB.Col[k].end(); p++){
newmat(matA.Indx[c],p->first) +=matA.Array[c]*matB.Array[p->second];
}
}
matA.destroy();
return _(newmat);
}
*/