CPPLapack
 All Classes Files Functions Variables Friends Pages
Functions
dgematrix-_dgbmatrix.hpp File Reference

Go to the source code of this file.

Functions

_dgematrix operator+ (const dgematrix &matA, const _dgbmatrix &matB)
 
_dgematrix operator- (const dgematrix &matA, const _dgbmatrix &matB)
 
_dgematrix operator* (const dgematrix &matA, const _dgbmatrix &matB)
 

Function Documentation

_dgematrix operator+ ( const dgematrix matA,
const _dgbmatrix matB 
)
inline

dgematrix+_dgbmatrix operator

Definition at line 84 of file dgematrix-_dgbmatrix.hpp.

References _(), _dgbmatrix::destroy(), i(), _dgbmatrix::kl, _dgbmatrix::ku, _dgbmatrix::m, dgematrix::m, dgematrix::n, and _dgbmatrix::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  dgematrix 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 m
matrix row size
Definition: dgematrix.hpp:9
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9
_dgematrix operator- ( const dgematrix matA,
const _dgbmatrix matB 
)
inline

dgematrix-_dgbmatrix operator

Definition at line 110 of file dgematrix-_dgbmatrix.hpp.

References _(), _dgbmatrix::destroy(), i(), _dgbmatrix::kl, _dgbmatrix::ku, _dgbmatrix::m, dgematrix::m, dgematrix::n, and _dgbmatrix::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  dgematrix 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 m
matrix row size
Definition: dgematrix.hpp:9
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9
_dgematrix operator* ( const dgematrix matA,
const _dgbmatrix matB 
)
inline

dgematrix*_dgbmatrix operator

Definition at line 136 of file dgematrix-_dgbmatrix.hpp.

References _(), _dgbmatrix::destroy(), i(), _dgbmatrix::kl, _dgbmatrix::ku, _dgbmatrix::m, dgematrix::m, dgematrix::n, _dgbmatrix::n, and dgematrix::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  dgematrix 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 m
matrix row size
Definition: dgematrix.hpp:9
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9