CPPLapack
 All Classes Files Functions Variables Friends Pages
_dssmatrix-dgbmatrix.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! _dgsmatrix+dgbmatrix operator */
3 /*
4 inline _dgematrix operator+(const _dgsmatrix& matA, const dgbmatrix& matB)
5 {CPPL_VERBOSE_REPORT;
6 #ifdef CPPL_DEBUG
7  if(matA.n!=matB.n || matA.m!=matB.m){
8  ERROR_REPORT;
9  std::cerr << "These two matrises can not make a summation." << std::endl
10  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
11  exit(1);
12  }
13 #endif//CPPL_DEBUG
14 
15  dgematrix newmat(matA);
16 
17  for(CPPL_INT i=0; i<matB.m; i++){
18  for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){
19  newmat(i,j)+=matB(i,j);
20  }
21  }
22 
23  matA.destroy();
24  return _(newmat);
25 }
26 */
27 //=============================================================================
28 /*! _dgsmatrix-dgbmatrix operator */
29 /*
30 inline _dgematrix operator-(const _dgsmatrix& matA, const dgbmatrix& matB)
31 {CPPL_VERBOSE_REPORT;
32 #ifdef CPPL_DEBUG
33  if(matA.n!=matB.n || matA.m!=matB.m){
34  ERROR_REPORT;
35  std::cerr << "These two matrises can not make a summation." << std::endl
36  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
37  exit(1);
38  }
39 #endif//CPPL_DEBUG
40 
41  dgematrix newmat(matA);
42 
43  for(CPPL_INT i=0; i<matB.m; i++){
44  for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){
45  newmat(i,j)-=matB(i,j);
46  }
47  }
48 
49  matA.destroy();
50  return _(newmat);
51 }
52 */
53 //=============================================================================
54 /*! _dgsmatrix*dgbmatrix operator */
55 /*
56 inline _dgematrix operator*(const _dgsmatrix& matA, const dgbmatrix& matB)
57 {CPPL_VERBOSE_REPORT;
58 #ifdef CPPL_DEBUG
59  if(matA.n!=matB.m){
60  ERROR_REPORT;
61  std::cerr << "These two matrises can not make a product." << std::endl
62  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
63  exit(1);
64  }
65 #endif//CPPL_DEBUG
66 
67  dgematrix newmat( matA.m, matB.n );
68  newmat.zero();
69 
70  for(CPPL_INT c=0; c<matA.vol; c++){
71  for(CPPL_INT k=max(0,matA.jndx[c]-matB.ku);
72  k<min(matB.m,matA.jndx[c]+matB.kl+1); k++){
73  newmat(matA.indx[c],k) += matA.array[c]*matB(matA.jndx[c],k);
74  }
75  }
76 
77  matA.destroy();
78  return _(newmat);
79 }
80 */