6 std::cerr <<
"# [MARK] dgbmatrix::operator=(const _dgbmatrix&)"
24 std::cerr <<
"# [MARK] dgbmatrix::operator+=(const _dgbmatrix&)"
29 if(N!=mat.
N || M!=mat.
M){
30 std::cerr <<
"[ERROR] dgbmatrix::operator+=(_dgbmatrix&)" << 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] dgbmatrix::operator-=(const _dgbmatrix&)"
79 if(N!=mat.
N || M!=mat.
M){
80 std::cerr <<
"[ERROR] dgbmatrix::operator-=(_dgbmatrix&)" << 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] dgbmatrix::operator*=(const _dgbmatrix&)"
129 std::cerr <<
"[ERROR] dgbmatrix::operator*=(_dgbmatrix&)" << 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++){
143 k< min( min(N,
i+KU+1), min(mat.
M,j+mat.
KL+1) ); k++){
163 std::cerr <<
"# [MARK] operator+(const dgbmatrix&, const _dgbmatrix&)"
168 if(matA.N!=matB.
N || matA.M!=matB.
M){
169 std::cerr <<
"[ERROR] operator+(dgbmatrix&, _dgbmatrix&)" << 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);
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 dgbmatrix&, const _dgbmatrix&)"
214 if(matA.N!=matB.
N || matA.M!=matB.
M){
215 std::cerr <<
"[ERROR] operator-(dgbmatrix&, _dgbmatrix&)" << 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;
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 dgbmatrix&, const _dgbmatrix&)"
250 std::cerr <<
"[ERROR] operator*(dgbmatrix&, _dgbmatrix&)" << 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 dgbmatrix 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++){
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);
dgbmatrix & operator=(const dgbmatrix &)
Definition: dgbmatrix-dgbmatrix.hpp:4
friend _dgematrix i(const dgbmatrix &)
Definition: dgbmatrix-calc.hpp:22
double max(double v1, double v2)
Return maximum.
Definition: variousFunctions.cpp:355
long KL
lower band width
Definition: _dgbmatrix.hpp:9
void shallow_copy(const _dgbmatrix &)
Definition: dgbmatrix-misc.hpp:107
long M
matrix row size
Definition: _dgbmatrix.hpp:7
void destroy() const
Definition: _dgbmatrix-misc.hpp:3
double & operator()(const long &, const long &)
Definition: dgbmatrix-io.hpp:3
long N
matrix column size
Definition: _dgbmatrix.hpp:8
dgbmatrix & operator+=(const dgbmatrix &)
Definition: dgbmatrix-dgbmatrix.hpp:24
friend _drovector operator-(const _drovector &)
Definition: _drovector-unary.hpp:15
Real Double-precision General Band Matrix Class.
Definition: dgbmatrix.hpp:3
dgbmatrix & operator*=(const dgbmatrix &)
Definition: dgbmatrix-dgbmatrix.hpp:121
void zero()
Definition: dgbmatrix-misc.hpp:29
friend _drovector operator*(const drovector &, const dgematrix &)
Definition: drovector-dgematrix.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class
Definition: _dgbmatrix.hpp:3
dgbmatrix & operator-=(const dgbmatrix &)
Definition: dgbmatrix-dgbmatrix.hpp:73
long KU
upper band width
Definition: _dgbmatrix.hpp:10
friend const _drovector & operator+(const _drovector &)
Definition: _drovector-unary.hpp:3
friend void swap(dgbmatrix &, dgbmatrix &)
Definition: dgbmatrix-misc.hpp:167