CPPLapack
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Public Attributes | Friends | List of all members
_dgsmatrix Class Reference

(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class More...

#include <_dgsmatrix.hpp>

Public Member Functions

 _dgsmatrix ()
 
 _dgsmatrix (const _dgsmatrix &)
 
 ~_dgsmatrix ()
 
_zgsmatrix to_zgsmatrix () const
 
_dgematrix to_dgematrix () const
 
double operator() (const CPPL_INT &, const CPPL_INT &) const
 
void write (const char *) const
 
void nullify () const
 
void destroy () const
 

Public Attributes

CPPL_INT m
 matrix row size More...
 
CPPL_INT n
 matrix column size More...
 
std::vector< dcomponentdata
 matrix data More...
 
std::vector< std::vector
< CPPL_INT > > 
rows
 array of vector to store the entry information of component for each row More...
 
std::vector< std::vector
< CPPL_INT > > 
cols
 array of vector to store the entry information of component for each column More...
 

Friends

std::ostream & operator<< (std::ostream &, const _dgsmatrix &)
 
_dgsmatrix t (const dgsmatrix &)
 
void idamax (CPPL_INT &, CPPL_INT &, const dgsmatrix &)
 
double damax (const dgsmatrix &)
 
const _dgsmatrixoperator+ (const _dgsmatrix &)
 
_dgsmatrix operator- (const _dgsmatrix &)
 
_dgematrix operator+ (const _dgsmatrix &, const dgematrix &)
 
_dgematrix operator+ (const _dgsmatrix &, const _dgematrix &)
 
_dgematrix operator+ (const _dgsmatrix &, const dsymatrix &)
 
_dgematrix operator+ (const _dgsmatrix &, const _dsymatrix &)
 
_dgematrix operator+ (const _dgsmatrix &, const dgbmatrix &)
 
_dgematrix operator+ (const _dgsmatrix &, const _dgbmatrix &)
 
_dgsmatrix operator+ (const _dgsmatrix &, const dgsmatrix &)
 
_dgsmatrix operator+ (const _dgsmatrix &, const _dgsmatrix &)
 
_dgsmatrix operator+ (const _dgsmatrix &, const dssmatrix &)
 
_dgsmatrix operator+ (const _dgsmatrix &, const _dssmatrix &)
 
_dgematrix operator- (const _dgsmatrix &, const dgematrix &)
 
_dgematrix operator- (const _dgsmatrix &, const _dgematrix &)
 
_dgematrix operator- (const _dgsmatrix &, const dsymatrix &)
 
_dgematrix operator- (const _dgsmatrix &, const _dsymatrix &)
 
_dgematrix operator- (const _dgsmatrix &, const dgbmatrix &)
 
_dgematrix operator- (const _dgsmatrix &, const _dgbmatrix &)
 
_dgsmatrix operator- (const _dgsmatrix &, const dgsmatrix &)
 
_dgsmatrix operator- (const _dgsmatrix &, const _dgsmatrix &)
 
_dgsmatrix operator- (const _dgsmatrix &, const dssmatrix &)
 
_dgsmatrix operator- (const _dgsmatrix &, const _dssmatrix &)
 
_dcovector operator* (const _dgsmatrix &, const dcovector &)
 
_dcovector operator* (const _dgsmatrix &, const _dcovector &)
 
_dgematrix operator* (const _dgsmatrix &, const dgematrix &)
 
_dgematrix operator* (const _dgsmatrix &, const _dgematrix &)
 
_dgematrix operator* (const _dgsmatrix &, const dsymatrix &)
 
_dgematrix operator* (const _dgsmatrix &, const _dsymatrix &)
 
_dgematrix operator* (const _dgsmatrix &, const dgbmatrix &)
 
_dgematrix operator* (const _dgsmatrix &, const _dgbmatrix &)
 
_dgsmatrix operator* (const _dgsmatrix &, const dgsmatrix &)
 
_dgsmatrix operator* (const _dgsmatrix &, const _dgsmatrix &)
 
_dgsmatrix operator* (const _dgsmatrix &, const dssmatrix &)
 
_dgsmatrix operator* (const _dgsmatrix &, const _dssmatrix &)
 
_dgsmatrix operator* (const _dgsmatrix &, const double &)
 
_dgsmatrix operator/ (const _dgsmatrix &, const double &)
 
_dgsmatrix operator* (const double &, const _dgsmatrix &)
 

Detailed Description

(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class

Definition at line 3 of file _dgsmatrix.hpp.

Constructor & Destructor Documentation

_dgsmatrix::_dgsmatrix ( )
inline

_dgsmatrix constructor without arguments

Definition at line 3 of file _dgsmatrix-constructor.hpp.

References cols, data, m, n, and rows.

4 {CPPL_VERBOSE_REPORT;
5  m =0;
6  n =0;
7  data.clear();
8  rows.clear();
9  cols.clear();
10 }
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgsmatrix::_dgsmatrix ( const _dgsmatrix mat)
inline

_dgsmatrix copy constructor

Definition at line 14 of file _dgsmatrix-constructor.hpp.

References cols, data, m, n, nullify(), and rows.

15 {CPPL_VERBOSE_REPORT;
16  m =mat.m;
17  n =mat.n;
18  data.swap(mat.data);
19  rows.swap(mat.rows);
20  cols.swap(mat.cols);
21 
22  mat.nullify();
23 }
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void nullify() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgsmatrix::~_dgsmatrix ( )
inline

_dgsmatrix destructor

Definition at line 31 of file _dgsmatrix-constructor.hpp.

References cols, data, and rows.

32 {CPPL_VERBOSE_REPORT;
33  data.clear();
34  rows.clear();
35  cols.clear();
36 }
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11

Member Function Documentation

_zgsmatrix _dgsmatrix::to_zgsmatrix ( ) const
inline

cast to _zgsmatrix

Definition at line 3 of file _dgsmatrix-cast.hpp.

References _(), data, destroy(), m, n, and zgsmatrix::put().

4 {CPPL_VERBOSE_REPORT;
5  zgsmatrix newmat(m,n,CPPL_INT(data.size()));
6 
7  const std::vector<dcomponent>::const_iterator data_end =data.end();
8  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
9  newmat.put(it->i, it->j, comple(it->v,0.));
10  }
11 
12  destroy();
13  return _(newmat);
14 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix _dgsmatrix::to_dgematrix ( ) const
inline

convert to _dgematrix

Definition at line 22 of file _dgsmatrix-cast.hpp.

References _(), data, destroy(), m, n, and dgematrix::zero().

Referenced by operator+(), and operator-().

23 {CPPL_VERBOSE_REPORT;
24  dgematrix newmat(m,n);
25  newmat.zero();
26 
27  const std::vector<dcomponent>::const_iterator data_end =data.end();
28  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
29  newmat(it->i,it->j) = it->v;
30  }
31 
32  destroy();
33  return _(newmat);
34 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
double _dgsmatrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
) const
inline

operator() for const object

Definition at line 3 of file _dgsmatrix-io.hpp.

References data, i(), m, n, and rows.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if( i<0 || j<0 || m<=i || n<=j ){
7  ERROR_REPORT;
8  std::cerr << "The required component is out of the matrix size." << std::endl
9  << "Your input is (" << i << "," << j << "), whereas the matrix size is (" << m << "," << n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  //////// search (i,j) component ////////
15  const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end();
16  for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){
17  if(data[*p].j==j){ return data[*p].v; }
18  }
19 
20  //////// (i,j) component was not found ////////
21  return 0.0;
22 }
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void _dgsmatrix::write ( const char *  filename) const
inline

Definition at line 53 of file _dgsmatrix-io.hpp.

References data, destroy(), m, and n.

54 {CPPL_VERBOSE_REPORT;
55  std::ofstream ofs(filename, std::ios::trunc);
56  ofs.setf(std::cout.flags());
57  ofs.precision(std::cout.precision());
58  ofs.width(std::cout.width());
59  ofs.fill(std::cout.fill());
60 
61  ofs << "#dgsmatrix " << m << " " << n << " " << data.size() << std::endl;
62 
63  const std::vector<dcomponent>::const_iterator data_end =data.end();
64  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
65  ofs << it->i << " " << it->j << " " << it->v << std::endl;
66  }
67 
68  ofs.close();
69  destroy();
70 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void _dgsmatrix::nullify ( ) const
inline

nullify all the matrix data

Definition at line 3 of file _dgsmatrix-misc.hpp.

References cols, data, m, n, and rows.

Referenced by _dgsmatrix(), dgsmatrix::dgsmatrix(), and dgsmatrix::shallow_copy().

4 {CPPL_VERBOSE_REPORT;
5  m=0;
6  n=0;
7  data.clear();
8  rows.clear();
9  cols.clear();
10 }
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void _dgsmatrix::destroy ( ) const
inline

destroy all the matrix data

Definition at line 14 of file _dgsmatrix-misc.hpp.

References cols, data, and rows.

Referenced by damax(), idamax(), operator*(), dgsmatrix::operator*=(), operator+(), dgsmatrix::operator+=(), operator-(), dgsmatrix::operator-=(), operator<<(), to_dgematrix(), to_zgsmatrix(), and write().

15 {CPPL_VERBOSE_REPORT;
16  data.clear();
17  rows.clear();
18  cols.clear();
19 }
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const _dgsmatrix mat 
)
friend

Definition at line 29 of file _dgsmatrix-io.hpp.

30 {CPPL_VERBOSE_REPORT;
31  for(CPPL_INT i=0; i<mat.m; i++){
32  for(CPPL_INT j=0; j<mat.n; j++){
33  std::vector<CPPL_INT>::iterator q;
34  const std::vector<CPPL_INT>::iterator mat_rows_i_end =mat.rows[i].end();
35  for(q=mat.rows[i].begin(); q!=mat_rows_i_end; q++){
36  if(mat.data[*q].j==j){ break; }
37  }
38  if(q!=mat_rows_i_end){ s << " " << mat.data[*q].v; }
39  else{ s << " x"; }
40  }
41  s << std::endl;
42  }
43 
44  mat.destroy();
45  return s;
46 }
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgsmatrix t ( const dgsmatrix mat)
friend

return transposed dgsmatrix

Definition at line 3 of file dgsmatrix-calc.hpp.

4 {CPPL_VERBOSE_REPORT;
5  dgsmatrix newmat =mat;
6 
7  std::swap(newmat.m,newmat.n);
8  std::swap(newmat.rows,newmat.cols);
9  const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end();
10  for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
11  std::swap(it->i,it->j);
12  }
13 
14  return _(newmat);
15 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: dgsmatrix.hpp:10
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: dgsmatrix.hpp:13
void swap(dcovector &u, dcovector &v)
_dcovector _(dcovector &vec)
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: dgsmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: dgsmatrix.hpp:9
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const dgsmatrix mat 
)
friend

search the index of element having the largest absolute value in 0-based numbering system

Definition at line 23 of file dgsmatrix-calc.hpp.

24 {CPPL_VERBOSE_REPORT;
25  //////// exception ////////
26  if(mat.data.size()==0){
27  WARNING_REPORT;
28  std::cerr << "The dgsmatrix is a zero matrix." << std::endl;
29  return;
30  }
31 
32  //////// find ////////
33  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
34  double vmax =0.;
35 
36  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
37  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
38  if( vmax < fabs(it->v) ){
39  vmax =fabs(it->v);
40  itx =it;
41  }
42  }
43 
44  i =itx->i;
45  j =itx->j;
46 }
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
friend _dgematrix i(const _dgematrix &)
double damax ( const dgsmatrix mat)
friend

return its largest absolute value

Definition at line 50 of file dgsmatrix-calc.hpp.

51 {CPPL_VERBOSE_REPORT;
52  //////// exception ////////
53  if(mat.data.size()==0){
54  return 0.;
55  }
56 
57  //////// find ////////
58  std::vector<dcomponent>::const_iterator itx(mat.data.begin());
59  double vmax =0.;
60 
61  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
62  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
63  if( vmax < fabs(it->v) ){
64  vmax =fabs(it->v);
65  itx =it;
66  }
67  }
68 
69  return itx->v;
70 }
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
const _dgsmatrix& operator+ ( const _dgsmatrix mat)
friend

+_dgsmatrix operator

Definition at line 3 of file _dgsmatrix-unary.hpp.

4 {CPPL_VERBOSE_REPORT;
5  return mat;
6 }
_dgsmatrix operator- ( const _dgsmatrix mat)
friend

-_dgsmatrix operator

Definition at line 10 of file _dgsmatrix-unary.hpp.

11 {CPPL_VERBOSE_REPORT;
12  const std::vector<dcomponent>::iterator mat_data_end =mat.data.end();
13  for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){
14  it->v = -it->v;
15  }
16 
17  return mat;
18 }
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgematrix operator+ ( const _dgsmatrix matA,
const dgematrix matB 
)
friend

_dgsmatrix+dgematrix operator

Definition at line 3 of file _dgsmatrix-dgematrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.m || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgematrix newmat(matB);
15 
16  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
18  newmat(it->i,it->j) += it->v;
19  }
20 
21  matA.destroy();
22  return _(newmat);
23 }
CPPL_INT m
matrix row size
Definition: dgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix operator+ ( const _dgsmatrix matA,
const _dgematrix matB 
)
friend

_dgsmatrix+_dgematrix operator

Definition at line 3 of file _dgsmatrix-_dgematrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.m || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
15  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
16  matB(it->i,it->j) += it->v;
17  }
18 
19  matA.destroy();
20  return matB;
21 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgematrix operator+ ( const _dgsmatrix matA,
const dsymatrix matB 
)
friend

_dgsmatrix+dsymatrix operator

Definition at line 3 of file _dgsmatrix-dsymatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.n || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgematrix newmat( matB.to_dgematrix() );
15 
16  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
18  newmat(it->i,it->j) += it->v;
19  }
20 
21  matA.destroy();
22  return _(newmat);
23 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
_dgematrix to_dgematrix() const
CPPL_INT n
matrix column size
Definition: dsymatrix.hpp:10
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix operator+ ( const _dgsmatrix matA,
const _dsymatrix matB 
)
friend

_dgsmatrix+_dsymatrix operator

Definition at line 3 of file _dgsmatrix-_dsymatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.m!=matB.m || matA.n!=matB.n){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgematrix newmat( matB.to_dgematrix() );
15 
16  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
18  newmat(it->i,it->j) += it->v;
19  }
20 
21  matA.destroy();
22  matB.destroy();
23  return _(newmat);
24 }
void destroy() const
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
_dgematrix to_dgematrix() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dsymatrix.hpp:11
_dcovector _(dcovector &vec)
CPPL_INT const & m
matrix row size
Definition: _dsymatrix.hpp:10
_dgematrix operator+ ( const _dgsmatrix matA,
const dgbmatrix matB 
)
friend

_dgsmatrix+dgbmatrix operator

Definition at line 3 of file _dgsmatrix-dgbmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgematrix newmat( matA.to_dgematrix() );
15 
16  for(CPPL_INT i=0; i<matB.m; i++){
17  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
18  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
19  newmat(i,j)+=matB(i,j);
20  }
21  }
22 
23  matA.destroy();
24  return _(newmat);
25 }
CPPL_INT m
matrix row size
Definition: dgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix to_dgematrix() const
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: dgbmatrix.hpp:11
CPPL_INT ku
upper band width
Definition: dgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: dgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_dgematrix operator+ ( const _dgsmatrix matA,
const _dgbmatrix matB 
)
friend

_dgsmatrix+_dgbmatrix operator

Definition at line 3 of file _dgsmatrix-_dgbmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgematrix newmat( matA.to_dgematrix() );
15 
16  for(CPPL_INT i=0; i<matB.m; i++){
17  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
18  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
19  newmat(i,j)+=matB(i,j);
20  }
21  }
22 
23  matA.destroy();
24  matB.destroy();
25  return _(newmat);
26 }
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix to_dgematrix() const
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9
_dgsmatrix operator+ ( const _dgsmatrix matA,
const dgsmatrix matB 
)
friend

_dgsmatrix+dgsmatrix operator

Definition at line 3 of file _dgsmatrix-dgsmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgsmatrix newmat(matA);
15 
16  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
17  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
18  newmat(it->i,it->j) += it->v;
19  }
20 
21  return _(newmat);
22 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: dgsmatrix.hpp:9
_dgsmatrix operator+ ( const _dgsmatrix matA,
const _dgsmatrix matB 
)
friend

_dgsmatrix+_dgsmatrix operator

Definition at line 3 of file _dgsmatrix-_dgsmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(matA.n!=matB.n || matA.m!=matB.m){
7  ERROR_REPORT;
8  std::cerr << "These two matrises can not make a summation." << std::endl
9  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dgsmatrix newmat(matA);
15 
16  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
17  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
18  newmat(it->i,it->j) += it->v;
19  }
20 
21  matB.destroy();
22  return _(newmat);
23 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgsmatrix operator+ ( const _dgsmatrix ,
const dssmatrix  
)
friend
_dgsmatrix operator+ ( const _dgsmatrix ,
const _dssmatrix  
)
friend
_dgematrix operator- ( const _dgsmatrix matA,
const dgematrix matB 
)
friend

_dgsmatrix-dgematrix operator

Definition at line 27 of file _dgsmatrix-dgematrix.hpp.

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.m!=matB.m || matA.n!=matB.n){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  dgematrix newmat(-matB);
39 
40  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
41  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
42  newmat(it->i,it->j) += it->v;
43  }
44 
45  matA.destroy();
46  return _(newmat);
47 }
CPPL_INT m
matrix row size
Definition: dgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix operator- ( const _dgsmatrix matA,
const _dgematrix matB 
)
friend

_dgsmatrix-_dgematrix operator

Definition at line 25 of file _dgsmatrix-_dgematrix.hpp.

26 {CPPL_VERBOSE_REPORT;
27 #ifdef CPPL_DEBUG
28  if(matA.m!=matB.m || matA.n!=matB.n){
29  ERROR_REPORT;
30  std::cerr << "These two matrises can not make a subtraction." << std::endl
31  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
32  exit(1);
33  }
34 #endif//CPPL_DEBUG
35 
36  //// change sign ////
37  for(int i=0; i<matB.m*matB.n; i++){
38  matB.array[i] = -matB.array[i];
39  }
40 
41  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
42  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
43  matB(it->i,it->j) += it->v;
44  }
45 
46  matA.destroy();
47  return matB;
48 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
double * array
1D array to store matrix data
Definition: _dgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgematrix operator- ( const _dgsmatrix matA,
const dsymatrix matB 
)
friend

_dgsmatrix-dsymatrix operator

Definition at line 27 of file _dgsmatrix-dsymatrix.hpp.

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.m!=matB.n || matA.n!=matB.n){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  dgematrix newmat( (-matB).to_dgematrix() );
39 
40  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
41  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
42  newmat(it->i,it->j) += it->v;
43  }
44 
45  matA.destroy();
46  return _(newmat);
47 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix to_dgematrix() const
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: dsymatrix.hpp:10
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix operator- ( const _dgsmatrix matA,
const _dsymatrix matB 
)
friend

_dgsmatrix-_dsymatrix operator

Definition at line 28 of file _dgsmatrix-_dsymatrix.hpp.

29 {CPPL_VERBOSE_REPORT;
30 #ifdef CPPL_DEBUG
31  if(matA.m!=matB.m || matA.n!=matB.n){
32  ERROR_REPORT;
33  std::cerr << "These two matrises can not make a subtraction." << std::endl
34  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
35  exit(1);
36  }
37 #endif//CPPL_DEBUG
38 
39  //// shallow copy to dgematrix ////
40  dgematrix newmat( (-matB).to_dgematrix() );
41 
42  //// add ////
43  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
44  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
45  newmat(it->i,it->j) += it->v;
46  }
47 
48  matA.destroy();
49  matB.destroy();
50  return _(newmat);
51 }
void destroy() const
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix to_dgematrix() const
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dsymatrix.hpp:11
_dcovector _(dcovector &vec)
CPPL_INT const & m
matrix row size
Definition: _dsymatrix.hpp:10
_dgematrix operator- ( const _dgsmatrix matA,
const dgbmatrix matB 
)
friend

_dgsmatrix-dgbmatrix operator

Definition at line 29 of file _dgsmatrix-dgbmatrix.hpp.

30 {CPPL_VERBOSE_REPORT;
31 #ifdef CPPL_DEBUG
32  if(matA.n!=matB.n || matA.m!=matB.m){
33  ERROR_REPORT;
34  std::cerr << "These two matrises can not make a summation." << std::endl
35  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
36  exit(1);
37  }
38 #endif//CPPL_DEBUG
39 
40  dgematrix newmat( matA.to_dgematrix() );
41 
42  for(CPPL_INT i=0; i<matB.m; i++){
43  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
44  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
45  newmat(i,j)-=matB(i,j);
46  }
47  }
48 
49  matA.destroy();
50  return _(newmat);
51 }
CPPL_INT m
matrix row size
Definition: dgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix to_dgematrix() const
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: dgbmatrix.hpp:11
CPPL_INT ku
upper band width
Definition: dgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: dgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_dgematrix operator- ( const _dgsmatrix matA,
const _dgbmatrix matB 
)
friend

_dgsmatrix-_dgbmatrix operator

Definition at line 30 of file _dgsmatrix-_dgbmatrix.hpp.

31 {CPPL_VERBOSE_REPORT;
32 #ifdef CPPL_DEBUG
33  if(matA.n!=matB.n || matA.m!=matB.m){
34  ERROR_REPORT;
35  std::cerr << "These two matrises can not make a summation." << std::endl
36  << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl;
37  exit(1);
38  }
39 #endif//CPPL_DEBUG
40 
41  dgematrix newmat( matA.to_dgematrix() );
42 
43  for(CPPL_INT i=0; i<matB.m; i++){
44  const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1);
45  for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){
46  newmat(i,j)-=matB(i,j);
47  }
48  }
49 
50  matA.destroy();
51  matB.destroy();
52  return _(newmat);
53 }
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix to_dgematrix() const
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9
_dgsmatrix operator- ( const _dgsmatrix matA,
const dgsmatrix matB 
)
friend

_dgsmatrix-dgsmatrix operator

Definition at line 26 of file _dgsmatrix-dgsmatrix.hpp.

27 {CPPL_VERBOSE_REPORT;
28 #ifdef CPPL_DEBUG
29  if(matA.n!=matB.n || matA.m!=matB.m){
30  ERROR_REPORT;
31  std::cerr << "These two matrises can not make a subtraction." << std::endl
32  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
33  exit(1);
34  }
35 #endif//CPPL_DEBUG
36 
37  dgsmatrix newmat(matA);
38 
39  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
40  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
41  newmat(it->i,it->j) -= it->v;
42  }
43 
44  return _(newmat);
45 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: dgsmatrix.hpp:9
_dgsmatrix operator- ( const _dgsmatrix matA,
const _dgsmatrix matB 
)
friend

_dgsmatrix-_dgsmatrix operator

Definition at line 27 of file _dgsmatrix-_dgsmatrix.hpp.

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(matA.n!=matB.n || matA.m!=matB.m){
31  ERROR_REPORT;
32  std::cerr << "These two matrises can not make a subtraction." << std::endl
33  << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  dgsmatrix newmat(matA);
39 
40  const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end();
41  for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){
42  newmat(it->i,it->j) -= it->v;
43  }
44 
45  matB.destroy();
46  return _(newmat);
47 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgsmatrix operator- ( const _dgsmatrix ,
const dssmatrix  
)
friend
_dgsmatrix operator- ( const _dgsmatrix ,
const _dssmatrix  
)
friend
_dcovector operator* ( const _dgsmatrix mat,
const dcovector vec 
)
friend

_dgsmatrix*dcovector operator

Definition at line 3 of file _dgsmatrix-dcovector.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(mat.n!=vec.l){
7  ERROR_REPORT;
8  std::cerr << "These matrix and vector can not make a product." << std::endl
9  << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dcovector newvec(mat.m);
15  newvec.zero();
16 
17  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
18  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
19  newvec(it->i) += it->v*vec(it->j);
20  }
21 
22  mat.destroy();
23  return _(newvec);
24 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT l
vector size
Definition: dcovector.hpp:9
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
_dcovector _(dcovector &vec)
_dcovector operator* ( const _dgsmatrix mat,
const _dcovector vec 
)
friend

_dgsmatrix*_dcovector operator

Definition at line 3 of file _dgsmatrix-_dcovector.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(mat.n!=vec.l){
7  ERROR_REPORT;
8  std::cerr << "These matrix and vector can not make a product." << std::endl
9  << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  dcovector newvec(mat.m);
15  newvec.zero();
16 
17  const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end();
18  for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
19  newvec(it->i) += it->v * vec(it->j);
20  }
21 
22  mat.destroy();
23  vec.destroy();
24  return _(newvec);
25 }
CPPL_INT l
vector size
Definition: _dcovector.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void destroy() const
Real Double-precision Column Vector Class.
Definition: dcovector.hpp:3
_dcovector _(dcovector &vec)
_dgematrix operator* ( const _dgsmatrix matA,
const dgematrix matB 
)
friend

_dgsmatrix*dgematrix operator

Definition at line 51 of file _dgsmatrix-dgematrix.hpp.

52 {CPPL_VERBOSE_REPORT;
53 #ifdef CPPL_DEBUG
54  if(matA.n!=matB.m){
55  ERROR_REPORT;
56  std::cerr << "These two matrises can not make a product." << std::endl
57  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  dgematrix newmat(matA.m, matB.n);
63  newmat.zero();
64 
65  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
66  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
67  for(CPPL_INT j=0; j<matB.n; j++){
68  newmat(it->i,j) += it->v*matB(it->j,j);
69  }
70  }
71 
72  matA.destroy();
73  return _(newmat);
74 }
CPPL_INT m
matrix row size
Definition: dgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgematrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix operator* ( const _dgsmatrix matA,
const _dgematrix matB 
)
friend

_dgsmatrix*_dgematrix operator

Definition at line 52 of file _dgsmatrix-_dgematrix.hpp.

53 {CPPL_VERBOSE_REPORT;
54 #ifdef CPPL_DEBUG
55  if(matA.n!=matB.m){
56  ERROR_REPORT;
57  std::cerr << "These two matrises can not make a product." << std::endl
58  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
59  exit(1);
60  }
61 #endif//CPPL_DEBUG
62 
63  dgematrix newmat(matA.m, matB.n);
64  newmat.zero();
65 
66  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
67  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
68  for(CPPL_INT j=0; j<matB.n; j++){
69  newmat(it->i,j) += it->v *matB(it->j,j);
70  }
71  }
72 
73  matA.destroy();
74  matB.destroy();
75  return _(newmat);
76 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgematrix.hpp:9
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: _dgematrix.hpp:10
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void destroy() const
_dcovector _(dcovector &vec)
_dgematrix operator* ( const _dgsmatrix matA,
const dsymatrix matB 
)
friend

_dgsmatrix*dsymatrix operator

Definition at line 51 of file _dgsmatrix-dsymatrix.hpp.

52 {CPPL_VERBOSE_REPORT;
53 #ifdef CPPL_DEBUG
54  if(matA.n!=matB.n){
55  ERROR_REPORT;
56  std::cerr << "These two matrises can not make a product." << std::endl
57  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  dgematrix newmat(matA.m, matB.n);
63  newmat.zero();
64 
65  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
66  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
67  for(CPPL_INT i=0; i<matB.n; i++){
68  newmat(it->i,i) += it->v*matB(it->j,i);
69  }
70  }
71 
72  matA.destroy();
73  return _(newmat);
74 }
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: dsymatrix.hpp:10
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgematrix operator* ( const _dgsmatrix matA,
const _dsymatrix matB 
)
friend

_dgsmatrix*_dsymatrix operator

Definition at line 55 of file _dgsmatrix-_dsymatrix.hpp.

56 {CPPL_VERBOSE_REPORT;
57 #ifdef CPPL_DEBUG
58  if(matA.n!=matB.m){
59  ERROR_REPORT;
60  std::cerr << "These two matrises can not make a product." << std::endl
61  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
62  exit(1);
63  }
64 #endif//CPPL_DEBUG
65 
66  dgematrix newmat(matA.m, matB.n);
67  newmat.zero();
68 
69  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
70  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
71  for(CPPL_INT i=0; i<matB.n; i++){
72  newmat(it->i,i) += it->v*matB(it->j,i);
73  }
74  }
75 
76  matA.destroy();
77  matB.destroy();
78  return _(newmat);
79 }
void destroy() const
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
_dgematrix i(const _dgbmatrix &mat)
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dsymatrix.hpp:11
_dcovector _(dcovector &vec)
CPPL_INT const & m
matrix row size
Definition: _dsymatrix.hpp:10
_dgematrix operator* ( const _dgsmatrix matA,
const dgbmatrix matB 
)
friend

_dgsmatrix*dgbmatrix operator

Definition at line 55 of file _dgsmatrix-dgbmatrix.hpp.

56 {CPPL_VERBOSE_REPORT;
57 #ifdef CPPL_DEBUG
58  if(matA.n!=matB.m){
59  ERROR_REPORT;
60  std::cerr << "These two matrises can not make a product." << std::endl
61  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
62  exit(1);
63  }
64 #endif//CPPL_DEBUG
65 
66  dgematrix newmat( matA.m, matB.n );
67  newmat.zero();
68 
69  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
70  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
71  const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1);
72  for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){
73  newmat(it->i,j) += it->v*matB(it->j,j);
74  }
75  }
76 
77  matA.destroy();
78  return _(newmat);
79 }
CPPL_INT m
matrix row size
Definition: dgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: dgbmatrix.hpp:11
CPPL_INT ku
upper band width
Definition: dgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: dgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_dgematrix operator* ( const _dgsmatrix matA,
const _dgbmatrix matB 
)
friend

_dgsmatrix*_dgbmatrix operator

Definition at line 57 of file _dgsmatrix-_dgbmatrix.hpp.

58 {CPPL_VERBOSE_REPORT;
59 #ifdef CPPL_DEBUG
60  if(matA.n!=matB.m){
61  ERROR_REPORT;
62  std::cerr << "These two matrises can not make a product." << std::endl
63  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
64  exit(1);
65  }
66 #endif//CPPL_DEBUG
67 
68  dgematrix newmat( matA.m, matB.n );
69  newmat.zero();
70 
71  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
72  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
73  const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1);
74  for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){
75  newmat(it->i,j) += it->v*matB(it->j,j);
76  }
77  }
78 
79  matA.destroy();
80  matB.destroy();
81  return _(newmat);
82 }
CPPL_INT ku
upper band width
Definition: _dgbmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
void destroy() const
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
CPPL_INT kl
lower band width
Definition: _dgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgbmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
CPPL_INT m
matrix row size
Definition: _dgbmatrix.hpp:9
_dgsmatrix operator* ( const _dgsmatrix matA,
const dgsmatrix matB 
)
friend

_dgsmatrix*dgsmatrix operator

Definition at line 49 of file _dgsmatrix-dgsmatrix.hpp.

50 {CPPL_VERBOSE_REPORT;
51 #ifdef CPPL_DEBUG
52  if(matA.n!=matB.m){
53  ERROR_REPORT;
54  std::cerr << "These two matrises can not make a product." << std::endl
55  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
56  exit(1);
57  }
58 #endif//CPPL_DEBUG
59 
60  dgsmatrix newmat( matA.m, matB.n );
61 
62  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
63  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
64  CPPL_INT k =it->j;
65  const std::vector<CPPL_INT>::const_iterator matB_rows_k_end =matB.rows[k].end();
66  for(std::vector<CPPL_INT>::const_iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){
67  newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v;
68  }
69  }
70 
71  matA.destroy();
72  return _(newmat);
73 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: dgsmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: dgsmatrix.hpp:9
_dgsmatrix operator* ( const _dgsmatrix matA,
const _dgsmatrix matB 
)
friend

_dgsmatrix*_dgsmatrix operator

Definition at line 51 of file _dgsmatrix-_dgsmatrix.hpp.

52 {CPPL_VERBOSE_REPORT;
53 #ifdef CPPL_DEBUG
54  if(matA.n!=matB.m){
55  ERROR_REPORT;
56  std::cerr << "These two matrises can not make a product." << std::endl
57  << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl;
58  exit(1);
59  }
60 #endif//CPPL_DEBUG
61 
62  dgsmatrix newmat(matA.m, matB.n);
63 
64  const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end();
65  for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
66  CPPL_INT k =it->j;
67  const std::vector<CPPL_INT>::iterator matB_rows_k_end =matB.rows[k].end();
68  for(std::vector<CPPL_INT>::iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){
69  newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v;
70  }
71  }
72 
73  matA.destroy();
74  matB.destroy();
75  return _(newmat);
76 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void destroy() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dcovector _(dcovector &vec)
_dgsmatrix operator* ( const _dgsmatrix ,
const dssmatrix  
)
friend
_dgsmatrix operator* ( const _dgsmatrix ,
const _dssmatrix  
)
friend
_dgsmatrix operator* ( const _dgsmatrix mat,
const double &  d 
)
friend

_dgsmatrix*double operator

Definition at line 3 of file _dgsmatrix-double.hpp.

4 {CPPL_VERBOSE_REPORT;
5  const std::vector<dcomponent>::iterator mat_data_end =mat.data.end();
6  for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){
7  it->v *= d;
8  }
9 
10  return mat;
11 }
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgsmatrix operator/ ( const _dgsmatrix mat,
const double &  d 
)
friend

_dgsmatrix/double operator

Definition at line 15 of file _dgsmatrix-double.hpp.

16 {CPPL_VERBOSE_REPORT;
17  const std::vector<dcomponent>::iterator mat_data_end =mat.data.end();
18  for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){
19  it->v /= d;
20  }
21 
22  return mat;
23 }
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
_dgsmatrix operator* ( const double &  d,
const _dgsmatrix mat 
)
friend

double*_dgsmatrix operator

Definition at line 3 of file double-_dgsmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5  const std::vector<dcomponent>::iterator mat_data_end =mat.data.end();
6  for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){
7  it->v *= d;
8  }
9 
10  return mat;
11 }
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11

Member Data Documentation

CPPL_INT _dgsmatrix::m
mutable
CPPL_INT _dgsmatrix::n
mutable
std::vector<dcomponent> _dgsmatrix::data
mutable
std::vector< std::vector<CPPL_INT> > _dgsmatrix::rows
mutable

array of vector to store the entry information of component for each row

Definition at line 12 of file _dgsmatrix.hpp.

Referenced by _(), _dgsmatrix(), destroy(), dgsmatrix::dgsmatrix(), nullify(), operator()(), operator*(), dgsmatrix::operator*=(), operator<<(), dgsmatrix::shallow_copy(), t(), and ~_dgsmatrix().

std::vector< std::vector<CPPL_INT> > _dgsmatrix::cols
mutable

array of vector to store the entry information of component for each column

Definition at line 13 of file _dgsmatrix.hpp.

Referenced by _(), _dgsmatrix(), destroy(), dgsmatrix::dgsmatrix(), nullify(), dgsmatrix::shallow_copy(), t(), and ~_dgsmatrix().


The documentation for this class was generated from the following files: