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