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

Go to the source code of this file.

Functions

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

Function Documentation

_zgbmatrix operator+ ( const zgbmatrix matA,
const zgbmatrix matB 
)
inline

zgbmatrix+zgbmatrix operator

Definition at line 140 of file zgbmatrix-zgbmatrix.hpp.

References _(), i(), zgbmatrix::kl, zgbmatrix::ku, zgbmatrix::m, zgbmatrix::n, and zgbmatrix::zero().

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

zgbmatrix-zgbmatrix operator

Definition at line 170 of file zgbmatrix-zgbmatrix.hpp.

References _(), i(), zgbmatrix::kl, zgbmatrix::ku, zgbmatrix::m, zgbmatrix::n, and zgbmatrix::zero().

171 {CPPL_VERBOSE_REPORT;
172 #ifdef CPPL_DEBUG
173  if(matA.n!=matB.n || matA.m!=matB.m){
174  ERROR_REPORT;
175  std::cerr << "These two matrises can not make a subtraction." << std::endl
176  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
177  exit(1);
178  }
179 #endif//CPPL_DEBUG
180 
181  zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku));
182  newmat.zero();
183 
184  for(CPPL_INT i=0; i<matA.m; i++){
185  const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1);
186  for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){
187  newmat(i,j) += matA(i,j);
188  }
189  const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1);
190  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){
191  newmat(i,j) -= matB(i,j);
192  }
193  }
194 
195  return _(newmat);
196 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_dcovector _(dcovector &vec)
_zgbmatrix operator* ( const zgbmatrix matA,
const zgbmatrix matB 
)
inline

zgbmatrix*zgbmatrix operator

Definition at line 200 of file zgbmatrix-zgbmatrix.hpp.

References _(), i(), zgbmatrix::kl, zgbmatrix::ku, zgbmatrix::m, zgbmatrix::n, and zgbmatrix::zero().

201 {CPPL_VERBOSE_REPORT;
202 #ifdef CPPL_DEBUG
203  if(matA.n!=matB.m){
204  ERROR_REPORT;
205  std::cerr << "These two matrises can not make a product." << std::endl
206  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
207  exit(1);
208  }
209 #endif//CPPL_DEBUG
210 
211  zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) );
212  newmat.zero();
213 
214  for(CPPL_INT i=0; i<newmat.m; i++){
215  const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1);
216  for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){
217  const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) );
218  for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){
219  newmat(i,j) += matA(i,k)*matB(k,j);
220  }
221  }
222  }
223 
224  return _(newmat);
225 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_dcovector _(dcovector &vec)