Пример #1
0
/*! dsymatrix*dsymatrix operator */
inline _dgematrix operator*(const dsymatrix& matA, const dsymatrix& matB)
{
#ifdef  CPPL_VERBOSE
    std::cerr << "# [MARK] operator*(const dsymatrix&, const dsymatrix&)"
              << std::endl;
#endif//CPPL_VERBOSE

#ifdef  CPPL_DEBUG
    if(matA.N!=matB.N) {
        std::cerr << "[ERROR] operator*(dsymatrix&, dsymatrix&)" << std::endl
                  << "These two matrises can not make a product." << std::endl
                  << "Your input was (" << matA.N << "x" << matA.N << ") * ("
                  << matB.N << "x" << matB.N << ")." << std::endl;
        exit(1);
    }
#endif//CPPL_DEBUG

    matA.complete();
    matB.complete();
    dgematrix newmat(matA.N, matA.N);

    dgemm_( 'N', 'N', matA.N, matB.N, matA.N, 1.0, matA.Array, matA.N,
            matB.Array, matB.N, 0.0, newmat.array, matA.N );

    return _(newmat);
}
Пример #2
0
/*! dgsmatrix+dsymatrix operator */
inline _dgematrix operator+(const dgsmatrix& matA, const dsymatrix& matB)
{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.m!=matB.n || matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "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
  
  dgematrix newmat( matB.to_dgematrix() );
  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++){
    newmat(it->i,it->j) += it->v;
  }
  
  return _(newmat);
}
Пример #3
0
/*! dsymatrix*_dsymatrix operator */
inline _dgematrix operator*(const dsymatrix& matA, const _dsymatrix& matB)
{VERBOSE_REPORT;
#ifdef  CPPL_DEBUG
  if(matA.n!=matB.n){
    ERROR_REPORT;
    std::cerr << "These two matrises can not make a product." << std::endl
              << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
    exit(1);
  }
#endif//CPPL_DEBUG
  
  matA.complete();
  matB.complete();  
  dgematrix newmat( matA.n, matA.n );
  
  dgemm_( 'n', 'n', matA.n, matB.n, matA.n, 1.0, matA.array, matA.n,
          matB.array, matB.n, 0.0, newmat.array, matA.n );
  
  matB.destroy();
  return _(newmat);
}