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

Go to the source code of this file.

Functions

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

Function Documentation

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

_zgbmatrix+zhematrix operator

Definition at line 3 of file _zgbmatrix-zhematrix.hpp.

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.n || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zgematrix newmat( matB.to_zgematrix() );
15 
16  for(CPPL_INT i=0; i<matA.m; i++){
17  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
18  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
19  newmat(i,j) += matA(i,j);
20  }
21  }
22 
23  matA.destroy();
24  return _(newmat);
25 }
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
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
_zgematrix to_zgematrix() const
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
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 _zgbmatrix matA,
const zhematrix matB 
)
inline

_zgbmatrix-zgematrix operator

Definition at line 29 of file _zgbmatrix-zhematrix.hpp.

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

30 {CPPL_VERBOSE_REPORT;
31 #ifdef CPPL_DEBUG
32  if(matA.m!=matB.n || matA.n!=matB.n){
33  ERROR_REPORT;
34  std::cerr << "These two matrises can not make a summation." << std::endl
35  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
36  exit(1);
37  }
38 #endif//CPPL_DEBUG
39 
40  zgematrix newmat( (-matB).to_zgematrix() );
41  for(CPPL_INT i=0; i<matA.m; i++){
42  const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1);
43  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){
44  newmat(i,j) += matA(i,j);
45  }
46  }
47 
48  matA.destroy();
49  return _(newmat);
50 }
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
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
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 _zgbmatrix matA,
const zhematrix matB 
)
inline

_zgbmatrix*zgematrix operator

Definition at line 54 of file _zgbmatrix-zhematrix.hpp.

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

55 {CPPL_VERBOSE_REPORT;
56 #ifdef CPPL_DEBUG
57  if(matA.n!=matB.n){
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 i=0; i<newmat.m; i++){
69  for(CPPL_INT j=0; j<newmat.n; j++){
70  const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1);
71  for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){
72  newmat(i,j) += matA(i,k)*matB(k,j);
73  }
74  }
75  }
76 
77  matA.destroy();
78  return _(newmat);
79 }
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
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)