//=============================================================================
/*! _dgematrix+dsymatrix operator */
inline _dgematrix operator+(const _dgematrix& matA, const dsymatrix& matB)
{VERBOSE_REPORT;
#ifdef CPPL_DEBUG
if(matA.n!=matB.n || matA.m!=matB.n){
std::cerr << "[ERROR] operator+(_dgematrix&, dsymatrix&)" << std::endl
<< "These two matrises can not make a summation." << std::endl
<< "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
for(long i=0; i<matB.n; i++){
for(long j=0; j<matB.n; j++){
matA(i,j)+=matB(i,j);
}
}
return matA;
}
//=============================================================================
/*! _dgematrix-dsymatrix operator */
inline _dgematrix operator-(const _dgematrix& matA, const dsymatrix& matB)
{VERBOSE_REPORT;
#ifdef CPPL_DEBUG
if(matA.n!=matB.n || matA.m!=matB.n){
std::cerr << "[ERROR] operator+(_dgematrix&, dsymatrix&)" << std::endl
<< "These two matrises can not make a summation." << std::endl
<< "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
for(long i=0; i<matB.n; i++){
for(long j=0; j<matB.n; j++){
matA(i,j)-=matB(i,j);
}
}
return matA;
}
//=============================================================================
/*! _dgematrix*dsymatrix operator */
inline _dgematrix operator*(const _dgematrix& matA, const dsymatrix& matB)
{VERBOSE_REPORT;
#ifdef CPPL_DEBUG
if(matA.n!=matB.n){
std::cerr << "[ERROR] operator*(_dgematrix&, dsymatrix&)" << std::endl
<< "These two matrises can not make a product." << std::endl
<< "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
exit(1);
}
#endif//CPPL_DEBUG
dgematrix newmat( matA.m, matB.n );
dsymm_( 'R', 'l', newmat.m, newmat.n, 1.0, matB.array, matB.n,
matA.array, matA.m, 0.0, newmat.array, newmat.m );
matA.destroy();
return _(newmat);
}