19 if(
n!=mat.
n ||
m!=mat.
m){
21 std::cerr <<
"These two matrises can not make a summation." << std::endl
22 <<
"Your input was" <<
"(" <<
m <<
"x"<<
n <<
","<<
kl <<
":"<<
ku <<
") "<<
"+=" <<
"("<< mat.
m <<
"x"<< mat.
n <<
","<< mat.
kl <<
":"<< mat.
ku <<
") " << std::endl;
28 for(CPPL_INT
i=0;
i<
m;
i++){
29 const CPPL_INT jmax =std::min(
n,
i+mat.
ku+1);
30 for(CPPL_INT j=std::max(CPPL_INT(0),
i-mat.
kl); j<jmax; j++){
41 for(CPPL_INT
i=0;
i<
m;
i++){
42 const CPPL_INT jmax1 =std::min(
n,
i+
ku+1);
43 for(CPPL_INT j=std::max(CPPL_INT(0),
i-
kl); j<jmax1; j++){
46 const CPPL_INT jmax2 =std::min(mat.
n,
i+mat.
ku+1);
47 for(CPPL_INT j=std::max(CPPL_INT(0),
i-mat.
kl); j<jmax2; j++){
48 newmat(
i,j)+=mat(
i,j);
64 if(
n!=mat.
n ||
m!=mat.
m){
66 std::cerr <<
"These two matrises can not make a subtraction." << std::endl
67 <<
"Your input was" <<
"(" <<
m <<
"x"<<
n <<
","<<
kl <<
":"<<
ku <<
") "<<
"-=" <<
"("<< mat.
m <<
"x"<< mat.
n <<
","<< mat.
kl <<
":"<< mat.
ku <<
") " << std::endl;
73 for(CPPL_INT
i=0;
i<
m;
i++){
74 const CPPL_INT jmax =std::min(
n,
i+mat.
ku+1);
75 for(CPPL_INT j=std::max(CPPL_INT(0),
i-mat.
kl); j<jmax; j++){
86 for(CPPL_INT
i=0;
i<
m;
i++){
87 const CPPL_INT jmax1 =std::min(
n,
i+
ku+1);
88 for(CPPL_INT j=std::max(CPPL_INT(0),
i-
kl); j<jmax1; j++){
91 const CPPL_INT jmax2 =std::min(mat.
n,
i+mat.
ku+1);
92 for(CPPL_INT j=std::max(CPPL_INT(0),
i-mat.
kl); j<jmax2; j++){
93 newmat(
i,j)-=mat(
i,j);
106 {CPPL_VERBOSE_REPORT;
110 std::cerr <<
"These two matrises can not make a product." << std::endl
111 <<
"Your input was (" <<
m <<
"x" <<
n <<
") * (" << mat.
m <<
"x" << mat.
n <<
")." << std::endl;
119 for(CPPL_INT
i=0;
i<newmat.
m;
i++){
120 const CPPL_INT jmax =std::min(newmat.
n,
i+newmat.
ku+1);
121 for(CPPL_INT j=std::max(CPPL_INT(0),
i-newmat.
kl); j<jmax; j++){
122 const CPPL_INT kmax =std::min( std::min(
n,
i+
ku+1), std::min(mat.
m,j+mat.
kl+1) );
123 for(CPPL_INT k=std::max( std::max(CPPL_INT(0),
i-
kl), std::max(CPPL_INT(0),j-mat.
ku) ); k<kmax; k++){
141 {CPPL_VERBOSE_REPORT;
143 if(matA.
n!=matB.
n || matA.
m!=matB.
m){
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;
151 if(matB.
kl>matA.
kl && matB.
ku>matA.
ku){
152 for(CPPL_INT
i=0;
i<matA.
m;
i++){
153 const CPPL_INT jmax =std::min(matA.
n,
i+matA.
ku+1);
154 for(CPPL_INT j=std::max(CPPL_INT(0),
i-matA.
kl); j<jmax; j++){
155 matB(
i,j)+=matA(
i,j);
165 for(CPPL_INT
i=0;
i<matA.
m;
i++){
166 const CPPL_INT jmax1 =std::min(matA.
n,
i+matA.
ku+1);
167 for(CPPL_INT j=std::max(CPPL_INT(0),
i-matA.
kl); j<jmax1; j++){
168 newmat(
i,j)+=matA(
i,j);
170 const CPPL_INT jmax2 =std::min(matB.
n,
i+matB.
ku+1);
171 for(CPPL_INT j=std::max(CPPL_INT(0),
i-matB.
kl); j<jmax2; j++){
172 newmat(
i,j)+=matB(
i,j);
184 {CPPL_VERBOSE_REPORT;
186 if(matA.
n!=matB.
n || matA.
m!=matB.
m){
188 std::cerr <<
"These two matrises can not make a subtraction." << std::endl
189 <<
"Your input was (" << matA.
m <<
"x" << matA.
n <<
") - (" << matB.
m <<
"x" << matB.
n <<
")." << std::endl;
197 for(CPPL_INT
i=0;
i<matA.
m;
i++){
198 const CPPL_INT jmax1 =std::min(matA.
n,
i+matA.
ku+1);
199 for(CPPL_INT j=std::max(CPPL_INT(0),
i-matA.
kl); j<jmax1; j++){
200 newmat(
i,j)+=matA(
i,j);
202 const CPPL_INT jmax2 =std::min(matB.
n,
i+matB.
ku+1);
203 for(CPPL_INT j=std::max(CPPL_INT(0),
i-matB.
kl); j<jmax2; j++){
204 newmat(
i,j)-=matB(
i,j);
215 {CPPL_VERBOSE_REPORT;
219 std::cerr <<
"These two matrises can not make a product." << std::endl
220 <<
"Your input was (" << matA.
m <<
"x" << matA.
n <<
") * (" << matB.
m <<
"x" << matB.
n <<
")." << std::endl;
225 dgbmatrix newmat( matA.
m, matB.
n, std::min(matA.
kl+matB.
kl,matA.
m-1), std::min(matA.
ku+matB.
ku,matB.
n-1) );
228 for(CPPL_INT
i=0;
i<newmat.
m;
i++){
229 const CPPL_INT jmax =std::min(newmat.
n,
i+newmat.
ku+1);
230 for(CPPL_INT j=std::max(CPPL_INT(0),
i-newmat.
kl); j<jmax; j++){
231 const CPPL_INT kmax =std::min( std::min(matA.
n,
i+matA.
ku+1), std::min(matB.
m,j+matB.
kl+1) );
232 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++){
233 newmat(
i,j)+= matA(
i,k)*matB(k,j);
dgbmatrix & operator=(const dgbmatrix &)
friend _dgematrix i(const dgbmatrix &)
CPPL_INT m
matrix row size
CPPL_INT ku
upper band width
void shallow_copy(const _dgbmatrix &)
_dgematrix i(const _dgbmatrix &mat)
_dgbmatrix operator*(const dgbmatrix &matA, const _dgbmatrix &matB)
CPPL_INT kl
lower band width
CPPL_INT kl
lower band width
_dgbmatrix operator-(const dgbmatrix &matA, const _dgbmatrix &matB)
CPPL_INT ku
upper band width
dgbmatrix & operator+=(const dgbmatrix &)
CPPL_INT n
matrix column size
Real Double-precision General Band Matrix Class.
dgbmatrix & operator*=(const dgbmatrix &)
_dgbmatrix operator+(const dgbmatrix &matA, const _dgbmatrix &matB)
(DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class
double & operator()(const CPPL_INT &, const CPPL_INT &)
CPPL_INT n
matrix column size
dgbmatrix & operator-=(const dgbmatrix &)
_dcovector _(dcovector &vec)
friend void swap(dgbmatrix &, dgbmatrix &)
CPPL_INT m
matrix row size