7 std::cerr <<
"# [MARK] zgbmatrix::operator=(const zgbmatrix&)"
27 std::cerr <<
"# [MARK] zgbmatrix::operator+=(const zgbmatrix&)"
32 if(N!=mat.N || M!=mat.M){
33 std::cerr <<
"[ERROR] zgbmatrix::operator+=(zgbmatrix&)" << std::endl
34 <<
"These two matrises can not make a summation." << std::endl
36 <<
"(" << M <<
"x"<< N <<
","<< KL <<
":"<< KU <<
") "<<
"+="
37 <<
"("<< mat.M <<
"x"<< mat.N <<
","<< mat.KL <<
":"<< mat.KU <<
") "
43 if(KL>=mat.KL && KU>=mat.KU){
44 for(
long i=0;
i<M;
i++){
45 for(
long j=max(0,
i-mat.KL); j<min(N,
i+mat.KU+1); j++){
54 zgbmatrix newmat(M,N,max(KL,mat.KL),max(KU,mat.KU));
56 for(
long i=0;
i<M;
i++){
57 for(
long j=max(0,
i-KL); j<min(N,
i+KU+1); j++){
60 for(
long j=max(0,
i-mat.KL); j<min(mat.N,
i+mat.KU+1); j++){
61 newmat(
i,j)+=mat(
i,j);
76 std::cerr <<
"# [MARK] zgbmatrix::operator-=(const zgbmatrix&)"
81 if(N!=mat.N || M!=mat.M){
82 std::cerr <<
"[ERROR] zgbmatrix::operator-=(zgbmatrix&)" << std::endl
83 <<
"These two matrises can not make a subtraction." << std::endl
85 <<
"(" << M <<
"x"<< N <<
","<< KL <<
":"<< KU <<
") "<<
"-="
86 <<
"("<< mat.M <<
"x"<< mat.N <<
","<< mat.KL <<
":"<< mat.KU <<
") "
92 if(KL>=mat.KL && KU>=mat.KU){
93 for(
long i=0;
i<M;
i++){
94 for(
long j=max(0,
i-mat.KL); j<min(N,
i+mat.KU+1); j++){
103 zgbmatrix newmat(M,N,max(KL,mat.KL),max(KU,mat.KU));
105 for(
long i=0;
i<M;
i++){
106 for(
long j=max(0,
i-KL); j<min(N,
i+KU+1); j++){
109 for(
long j=max(0,
i-mat.KL); j<min(mat.N,
i+mat.KU+1); j++){
110 newmat(
i,j)-=mat(
i,j);
124 std::cerr <<
"# [MARK] zgbmatrix::operator*=(const zgbmatrix&)"
130 std::cerr <<
"[ERROR] zgbmatrix::operator*=(zgbmatrix&)" << std::endl
131 <<
"These two matrises can not make a product." << std::endl
132 <<
"Your input was (" << M <<
"x" << N <<
") * ("
133 << mat.M <<
"x" << mat.N <<
")." << std::endl;
138 zgbmatrix newmat( M, mat.N, KU+mat.KL-1, KL+mat.KU+1 );
141 for(
long i=0;
i<newmat.
M;
i++){
142 for(
long j=max(0,
i-newmat.kl); j<min(newmat.n,
i+newmat.ku+1); j++){
143 for(
long k=max( max(0,
i-KL), max(0,j-mat.KU) );
144 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 zgbmatrix newmat(matA.M,matA.N,max(matA.KL,matB.KL),max(matA.KU,matB.KU));
180 for(
long i=0; i<matA.M; i++){
181 for(
long j=max(0,i-matA.KL); j<min(matA.N,i+matA.KU+1); j++){
182 newmat(i,j)+=matA(i,j);
184 for(
long j=max(0,i-matB.KL); j<min(matB.N,i+matB.KU+1); j++){
185 newmat(i,j)+=matB(i,j);
197 std::cerr <<
"# [MARK] operator-(const zgbmatrix&, const zgbmatrix&)"
202 if(matA.N!=matB.N || matA.M!=matB.M){
203 std::cerr <<
"[ERROR] operator-(zgbmatrix&, zgbmatrix&)" << std::endl
204 <<
"These two matrises can not make a subtraction." << std::endl
205 <<
"Your input was (" << matA.M <<
"x" << matA.N <<
") - ("
206 << matB.M <<
"x" << matB.N <<
")." << std::endl;
211 zgbmatrix newmat(matA.M,matA.N,max(matA.KL,matB.KL),max(matA.KU,matB.KU));
214 for(
long i=0; i<matA.M; i++){
215 for(
long j=max(0,i-matA.KL); j<min(matA.N,i+matA.KU+1); j++){
216 newmat(i,j)+=matA(i,j);
218 for(
long j=max(0,i-matB.KL); j<min(matB.N,i+matB.KU+1); j++){
219 newmat(i,j)-=matB(i,j);
231 std::cerr <<
"# [MARK] operator*(const zgbmatrix&, const zgbmatrix&)"
237 std::cerr <<
"[ERROR] operator*(zgbmatrix&, zgbmatrix&)" << std::endl
238 <<
"These two matrises can not make a product." << std::endl
239 <<
"Your input was (" << matA.M <<
"x" << matA.N <<
") * ("
240 << matB.M <<
"x" << matB.N <<
")." << std::endl;
245 zgbmatrix newmat( matA.M, matB.N, matA.KU+matB.KL-1, matA.KL+matB.KU+1 );
249 #pragma omp parallel for private(j,k)
250 for(i=0; i<newmat.m; i++){
251 for(j=max(0,i-newmat.kl); j<min(newmat.n,i+newmat.ku+1); j++){
252 for(k=max( max(0,i-matA.KL), max(0,j-matB.KU) );
253 k< min( min(matA.N,i+matA.KU+1), min(matB.M,j+matB.KL+1) ); k++){
254 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
void copy(const zgbmatrix &)
Definition: zgbmatrix-misc.hpp:74
zgbmatrix & operator+=(const zgbmatrix &)
Definition: zgbmatrix-zgbmatrix.hpp:24
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
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
long M
matrix row size
Definition: _zgematrix.hpp:7
friend const _zrovector & operator+(const _zrovector &)
Definition: _zrovector-unary.hpp:3
friend void swap(zgbmatrix &, zgbmatrix &)
Definition: zgbmatrix-misc.hpp:167
std::complex< double > * Array
1D Array to store vector data
Definition: _zrovector.hpp:8