CPPLapack
 All Classes Files Functions Variables Friends
_dsymatrix-_dsymatrix.hpp
Go to the documentation of this file.
00001 //=============================================================================
00002 /*! _dsymatrix+_dsymatrix operator */
00003 inline _dsymatrix operator+(const _dsymatrix& matA, const _dsymatrix& matB)
00004 {VERBOSE_REPORT;
00005 #ifdef  CPPL_DEBUG
00006   if(matA.n!=matB.n){
00007     ERROR_REPORT;
00008     std::cerr << "These two matrises can not make a summation." << std::endl
00009               << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
00010     exit(1);
00011   }
00012 #endif//CPPL_DEBUG
00013   
00014   for(long i=0; i<matA.n; i++){
00015     for(long j=0; j<=i; j++){
00016       matA.darray[j][i] +=matB.darray[j][i];
00017     }
00018   }
00019 
00020   matB.destroy();
00021   return matA;
00022 }
00023 
00024 //=============================================================================
00025 /*! _dsymatrix-_dsymatrix operator */
00026 inline _dsymatrix operator-(const _dsymatrix& matA, const _dsymatrix& matB)
00027 {VERBOSE_REPORT;
00028 #ifdef  CPPL_DEBUG
00029   if(matA.n!=matB.n){
00030     ERROR_REPORT;
00031     std::cerr << "These two matrises can not make a subtraction." << std::endl
00032               << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
00033     exit(1);
00034   }
00035 #endif//CPPL_DEBUG
00036 
00037   for(long i=0; i<matA.n; i++){
00038     for(long j=0; j<=i; j++){
00039       matA.darray[j][i] -=matB.darray[j][i];
00040     }
00041   }
00042   
00043   matB.destroy();
00044   return matA;
00045 }
00046 
00047 //=============================================================================
00048 /*! _dsymatrix*_dsymatrix operator */
00049 inline _dgematrix operator*(const _dsymatrix& matA, const _dsymatrix& matB)
00050 {VERBOSE_REPORT;
00051 #ifdef  CPPL_DEBUG
00052   if(matA.n!=matB.n){
00053     ERROR_REPORT;
00054     std::cerr << "These two matrises can not make a product." << std::endl
00055               << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
00056     exit(1);
00057   }
00058 #endif//CPPL_DEBUG
00059   
00060   matA.complete();
00061   matB.complete();
00062   dgematrix newmat(matA.n, matA.n);
00063   
00064   dgemm_( 'n', 'n', matA.n, matB.n, matA.n, 1.0, matA.array, matA.n,
00065           matB.array, matB.n, 0.0, newmat.array, matA.n );
00066   
00067   matA.destroy();
00068   matB.destroy();
00069   return _(newmat);
00070 }
 All Classes Files Functions Variables Friends