6 std::cerr <<
"# [MARK] zgbmatrix::operator=(const _zgbmatrix&)"
24 std::cerr <<
"# [MARK] zgbmatrix::operator+=(const _zgbmatrix&)"
29 if(N!=mat.
N || M!=mat.
M){
30 std::cerr <<
"[ERROR] zgbmatrix::operator+=(_zgbmatrix&)" << std::endl
31 <<
"These two matrises can not make a summation." << std::endl
33 <<
"(" << M <<
"x"<< N <<
","<< KL <<
":"<< KU <<
") "<<
"+="
34 <<
"("<< mat.
M <<
"x"<< mat.
N <<
","<< mat.
KL <<
":"<< mat.
KU <<
") "
40 if(KL>=mat.
KL && KU>=mat.
KU){
41 for(
long i=0;
i<M;
i++){
42 for(
long j=max(0,
i-mat.
KL); j<min(N,
i+mat.
KU+1); j++){
53 for(
long i=0;
i<M;
i++){
54 for(
long j=max(0,
i-KL); j<min(N,
i+KU+1); j++){
57 for(
long j=max(0,
i-mat.
KL); j<min(mat.
N,
i+mat.
KU+1); j++){
58 newmat(
i,j)+=mat(
i,j);
74 std::cerr <<
"# [MARK] zgbmatrix::operator-=(const _zgbmatrix&)"
79 if(N!=mat.
N || M!=mat.
M){
80 std::cerr <<
"[ERROR] zgbmatrix::operator-=(_zgbmatrix&)" << std::endl
81 <<
"These two matrises can not make a subtraction." << std::endl
83 <<
"(" << M <<
"x"<< N <<
","<< KL <<
":"<< KU <<
") "<<
"-="
84 <<
"("<< mat.
M <<
"x"<< mat.
N <<
","<< mat.
KL <<
":"<< mat.
KU <<
") "
90 if(KL>=mat.
KL && KU>=mat.
KU){
91 for(
long i=0;
i<M;
i++){
92 for(
long j=max(0,
i-mat.
KL); j<min(N,
i+mat.
KU+1); j++){
103 for(
long i=0;
i<M;
i++){
104 for(
long j=max(0,
i-KL); j<min(N,
i+KU+1); j++){
107 for(
long j=max(0,
i-mat.
KL); j<min(mat.
N,
i+mat.
KU+1); j++){
108 newmat(
i,j)-=mat(
i,j);
123 std::cerr <<
"# [MARK] zgbmatrix::operator*=(const _zgbmatrix&)"
129 std::cerr <<
"[ERROR] zgbmatrix::operator*=(_zgbmatrix&)" << std::endl
130 <<
"These two matrises can not make a product." << std::endl
131 <<
"Your input was (" << M <<
"x" << N <<
") * ("
132 << mat.
M <<
"x" << mat.
N <<
")." << std::endl;
140 for(
long i=0;
i<newmat.M;
i++){
141 for(
long j=max(0,
i-newmat.KL); j<min(newmat.N,
i+newmat.KU+1); j++){
142 for(
long k=max( max(0,
i-KL), max(0,j-mat.
KU) );
143 k< min( min(N,
i+KU+1), min(mat.
M,j+mat.
KL+1) ); k++){
163 std::cerr <<
"# [MARK] operator+(const zgbmatrix&, const _zgbmatrix&)"
168 if(matA.N!=matB.
N || matA.M!=matB.
M){
169 std::cerr <<
"[ERROR] operator+(zgbmatrix&, _zgbmatrix&)" << std::endl
170 <<
"These two matrises can not make a summation." << std::endl
171 <<
"Your input was (" << matA.M <<
"x" << matA.N <<
") + ("
172 << matB.
M <<
"x" << matB.
N <<
")." << std::endl;
177 if(matB.
KL>matA.KL && matB.
KU>matA.KU){
178 for(
long i=0; i<matA.M; i++){
179 for(
long j=max(0,i-matA.KL); j<min(matA.N,i+matA.KU+1); j++){
180 matB(i,j)+=matA(i,j);
187 zgbmatrix newmat(matA.M,matA.N,max(matA.KL,matB.
KL),max(matA.KU,matB.
KU));
190 for(
long i=0; i<matA.M; i++){
191 for(
long j=max(0,i-matA.KL); j<min(matA.N,i+matA.KU+1); j++){
192 newmat(i,j)+=matA(i,j);
194 for(
long j=max(0,i-matB.
KL); j<min(matB.
N,i+matB.
KU+1); j++){
195 newmat(i,j)+=matB(i,j);
209 std::cerr <<
"# [MARK] operator-(const zgbmatrix&, const _zgbmatrix&)"
214 if(matA.N!=matB.
N || matA.M!=matB.
M){
215 std::cerr <<
"[ERROR] operator-(zgbmatrix&, _zgbmatrix&)" << std::endl
216 <<
"These two matrises can not make a subtraction." << std::endl
217 <<
"Your input was (" << matA.M <<
"x" << matA.N <<
") - ("
218 << matB.
M <<
"x" << matB.
N <<
")." << std::endl;
223 zgbmatrix newmat(matA.M,matA.N,max(matA.KL,matB.
KL),max(matA.KU,matB.
KU));
226 for(
long i=0; i<matA.M; i++){
227 for(
long j=max(0,i-matA.KL); j<min(matA.N,i+matA.KU+1); j++){
228 newmat(i,j)+=matA(i,j);
230 for(
long j=max(0,i-matB.
KL); j<min(matB.
N,i+matB.
KU+1); j++){
231 newmat(i,j)-=matB(i,j);
244 std::cerr <<
"# [MARK] operator*(const zgbmatrix&, const _zgbmatrix&)"
250 std::cerr <<
"[ERROR] operator*(zgbmatrix&, _zgbmatrix&)" << std::endl
251 <<
"These two matrises can not make a product." << std::endl
252 <<
"Your input was (" << matA.M <<
"x" << matA.N <<
") * ("
253 << matB.
M <<
"x" << matB.
N <<
")." << std::endl;
258 zgbmatrix newmat( matA.M, matB.
N, matA.KU+matB.
KL-1, matA.KL+matB.
KU+1 );
262 #pragma omp parallel for private(j,k)
263 for(i=0; i<newmat.
m; i++){
264 for(j=max(0,i-newmat.
kl); j<min(newmat.
n,i+newmat.
ku+1); j++){
265 for(k=max( max(0,i-matA.KL), max(0,j-matB.
KU) );
266 k< min( min(matA.N,i+matA.KU+1), min(matB.
M,j+matB.
KL+1) ); k++){
267 newmat(i,j)+= matA(i,k)*matB(k,j);
std::complex< double > & operator()(const long &, const long &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
Definition: zgbmatrix-calc.hpp:22
zgbmatrix & operator*=(const zgbmatrix &)
Definition: zgbmatrix-zgbmatrix.hpp:121
friend _zrovector operator-(const _zrovector &)
Definition: _zrovector-unary.hpp:15
long N
matrix column size
Definition: _zgbmatrix.hpp:8
void destroy() const
Definition: _zgbmatrix-misc.hpp:3
zgbmatrix & operator+=(const zgbmatrix &)
Definition: zgbmatrix-zgbmatrix.hpp:24
long KU
upper band width
Definition: _zgbmatrix.hpp:10
zgbmatrix & operator=(const zgbmatrix &)
Definition: zgbmatrix-zgbmatrix.hpp:4
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
zgbmatrix & operator-=(const zgbmatrix &)
Definition: zgbmatrix-zgbmatrix.hpp:73
friend _zrovector operator*(const zrovector &, const zgematrix &)
Definition: zrovector-zgematrix.hpp:3
long M
matrix row size
Definition: _zgbmatrix.hpp:7
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
long const & kl
lower band width (readable)
Definition: zgbmatrix.hpp:18
void zero()
Definition: zgbmatrix-misc.hpp:29
long const & n
matrix column size (readable)
Definition: zgbmatrix.hpp:17
long const & m
matrix row size (readable)
Definition: zgbmatrix.hpp:16
friend const _zrovector & operator+(const _zrovector &)
Definition: _zrovector-unary.hpp:3
friend void swap(zgbmatrix &, zgbmatrix &)
Definition: zgbmatrix-misc.hpp:167
long KL
lower band width
Definition: _zgbmatrix.hpp:9
long const & ku
upper band width (readable)
Definition: zgbmatrix.hpp:19
void shallow_copy(const _zgbmatrix &)
Definition: zgbmatrix-misc.hpp:107