CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
zgematrix-_zgbmatrix.hpp File Reference

Go to the source code of this file.

Functions

_zgematrix operator+ (const zgematrix &matA, const _zgbmatrix &matB)
 
_zgematrix operator- (const zgematrix &matA, const _zgbmatrix &matB)
 
_zgematrix operator* (const zgematrix &matA, const _zgbmatrix &matB)
 

Function Documentation

_zgematrix operator+ ( const zgematrix matA,
const _zgbmatrix matB 
)
inline

zgematrix+_zgbmatrix operator

Definition at line 84 of file zgematrix-_zgbmatrix.hpp.

References _(), _zgbmatrix::destroy(), i(), _zgbmatrix::kl, _zgbmatrix::ku, _zgbmatrix::m, zgematrix::m, zgematrix::n, and _zgbmatrix::n.

85 {CPPL_VERBOSE_REPORT;
86 #ifdef CPPL_DEBUG
87  if(matA.n!=matB.n || matA.m!=matB.m){
88  ERROR_REPORT;
89  std::cerr << "These two matrises can not make a summation." << std::endl
90  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
91  exit(1);
92  }
93 #endif//CPPL_DEBUG
94 
95  zgematrix newmat(matA);
96 
97  for(CPPL_INT i=0; i<matB.m; i++){
98  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
99  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
100  newmat(i,j)+=matB(i,j);
101  }
102  }
103 
104  matB.destroy();
105  return _(newmat);
106 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
void destroy() const
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgematrix operator- ( const zgematrix matA,
const _zgbmatrix matB 
)
inline

zgematrix-_zgbmatrix operator

Definition at line 110 of file zgematrix-_zgbmatrix.hpp.

References _(), _zgbmatrix::destroy(), i(), _zgbmatrix::kl, _zgbmatrix::ku, _zgbmatrix::m, zgematrix::m, zgematrix::n, and _zgbmatrix::n.

111 {CPPL_VERBOSE_REPORT;
112 #ifdef CPPL_DEBUG
113  if(matA.n!=matB.n || matA.m!=matB.m){
114  ERROR_REPORT;
115  std::cerr << "These two matrises can not make a summation." << std::endl
116  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
117  exit(1);
118  }
119 #endif//CPPL_DEBUG
120 
121  zgematrix newmat(matA);
122 
123  for(CPPL_INT i=0; i<matB.m; i++){
124  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
125  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
126  newmat(i,j)-=matB(i,j);
127  }
128  }
129 
130  matB.destroy();
131  return _(newmat);
132 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
void destroy() const
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgematrix operator* ( const zgematrix matA,
const _zgbmatrix matB 
)
inline

zgematrix*_zgbmatrix operator

Definition at line 136 of file zgematrix-_zgbmatrix.hpp.

References _(), _zgbmatrix::destroy(), i(), _zgbmatrix::kl, _zgbmatrix::ku, _zgbmatrix::m, zgematrix::m, zgematrix::n, _zgbmatrix::n, and zgematrix::zero().

137 {CPPL_VERBOSE_REPORT;
138 #ifdef CPPL_DEBUG
139  if(matA.n!=matB.m){
140  ERROR_REPORT;
141  std::cerr << "These two matrises can not make a product." << std::endl
142  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
143  exit(1);
144  }
145 #endif//CPPL_DEBUG
146 
147  zgematrix newmat( matA.m, matB.n );
148  newmat.zero();
149 
150  for(CPPL_INT i=0; i<newmat.m; i++){
151  for(CPPL_INT j=0; j<newmat.n; j++){
152  const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1);
153  for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){
154  newmat(i,j)+=matA(i,k)*matB(k,j);
155  }
156  }
157  }
158 
159  matB.destroy();
160  return _(newmat);
161 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
void destroy() const
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)