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