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

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

#include <_zgsmatrix.hpp>

Public Member Functions

 _zgsmatrix ()
 
 _zgsmatrix (const _zgsmatrix &)
 
 ~_zgsmatrix ()
 
_zgematrix to_zgematrix () const
 
comple 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< zcomponentdata
 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 _zgsmatrix &)
 
_zgsmatrix t (const zgsmatrix &)
 
void idamax (CPPL_INT &, CPPL_INT &, const zgsmatrix &)
 
comple damax (const zgsmatrix &)
 
const _zgsmatrixoperator+ (const _zgsmatrix &)
 
_zgsmatrix operator- (const _zgsmatrix &)
 
_zgematrix operator+ (const _zgsmatrix &, const zgematrix &)
 
_zgematrix operator+ (const _zgsmatrix &, const _zgematrix &)
 
_zgematrix operator+ (const _zgsmatrix &, const zhematrix &)
 
_zgematrix operator+ (const _zgsmatrix &, const _zhematrix &)
 
_zgematrix operator+ (const _zgsmatrix &, const zgbmatrix &)
 
_zgematrix operator+ (const _zgsmatrix &, const _zgbmatrix &)
 
_zgsmatrix operator+ (const _zgsmatrix &, const zgsmatrix &)
 
_zgsmatrix operator+ (const _zgsmatrix &, const _zgsmatrix &)
 
_zgsmatrix operator+ (const _zgsmatrix &, const zhsmatrix &)
 
_zgsmatrix operator+ (const _zgsmatrix &, const _zhsmatrix &)
 
_zgematrix operator- (const _zgsmatrix &, const zgematrix &)
 
_zgematrix operator- (const _zgsmatrix &, const _zgematrix &)
 
_zgematrix operator- (const _zgsmatrix &, const zhematrix &)
 
_zgematrix operator- (const _zgsmatrix &, const _zhematrix &)
 
_zgematrix operator- (const _zgsmatrix &, const zgbmatrix &)
 
_zgematrix operator- (const _zgsmatrix &, const _zgbmatrix &)
 
_zgsmatrix operator- (const _zgsmatrix &, const zgsmatrix &)
 
_zgsmatrix operator- (const _zgsmatrix &, const _zgsmatrix &)
 
_zgsmatrix operator- (const _zgsmatrix &, const zhsmatrix &)
 
_zgsmatrix operator- (const _zgsmatrix &, const _zhsmatrix &)
 
_zcovector operator* (const _zgsmatrix &, const zcovector &)
 
_zcovector operator* (const _zgsmatrix &, const _zcovector &)
 
_zgematrix operator* (const _zgsmatrix &, const zgematrix &)
 
_zgematrix operator* (const _zgsmatrix &, const _zgematrix &)
 
_zgematrix operator* (const _zgsmatrix &, const zhematrix &)
 
_zgematrix operator* (const _zgsmatrix &, const _zhematrix &)
 
_zgematrix operator* (const _zgsmatrix &, const zgbmatrix &)
 
_zgematrix operator* (const _zgsmatrix &, const _zgbmatrix &)
 
_zgsmatrix operator* (const _zgsmatrix &, const zgsmatrix &)
 
_zgsmatrix operator* (const _zgsmatrix &, const _zgsmatrix &)
 
_zgsmatrix operator* (const _zgsmatrix &, const zhsmatrix &)
 
_zgsmatrix operator* (const _zgsmatrix &, const _zhsmatrix &)
 
_zgsmatrix operator* (const _zgsmatrix &, const double &)
 
_zgsmatrix operator* (const _zgsmatrix &, const comple &)
 
_zgsmatrix operator/ (const _zgsmatrix &, const double &)
 
_zgsmatrix operator/ (const _zgsmatrix &, const comple &)
 
_zgsmatrix operator* (const double &, const _zgsmatrix &)
 
_zgsmatrix operator* (const comple &, const _zgsmatrix &)
 

Detailed Description

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

Definition at line 3 of file _zgsmatrix.hpp.

Constructor & Destructor Documentation

_zgsmatrix::_zgsmatrix ( )
inline

_zgsmatrix constructor without arguments

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

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

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

_zgsmatrix copy constructor

Definition at line 15 of file _zgsmatrix-constructor.hpp.

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

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

_zgsmatrix destructor

Definition at line 33 of file _zgsmatrix-constructor.hpp.

References cols, data, and rows.

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

Member Function Documentation

_zgematrix _zgsmatrix::to_zgematrix ( ) const
inline

convert to _zgematrix

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

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

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

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

operator() for const object

Definition at line 3 of file _zgsmatrix-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 << "x" << 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 comple(0.0,0.0);
22 }
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _zgsmatrix.hpp:12
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
void _zgsmatrix::write ( const char *  filename) const
inline

Definition at line 53 of file _zgsmatrix-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 << "#zgsmatrix " << m << " " << n << " " << data.size() << std::endl;
62 
63  const std::vector<zcomponent>::const_iterator data_end =data.end();
64  for(std::vector<zcomponent>::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: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
void _zgsmatrix::nullify ( ) const
inline

nullify all the matrix data

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

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

Referenced by _zgsmatrix(), zgsmatrix::shallow_copy(), and zgsmatrix::zgsmatrix().

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 > > rows
array of vector to store the entry information of component for each row
Definition: _zgsmatrix.hpp:12
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _zgsmatrix.hpp:13
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
void _zgsmatrix::destroy ( ) const
inline

destroy all the matrix data

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

References cols, data, and rows.

Referenced by damax(), idamax(), operator*(), zgsmatrix::operator*=(), operator+(), zgsmatrix::operator+=(), operator-(), zgsmatrix::operator-=(), operator<<(), to_zgematrix(), and write().

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

Friends And Related Function Documentation

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

Definition at line 29 of file _zgsmatrix-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: _zgsmatrix.hpp:12
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgsmatrix t ( const zgsmatrix mat)
friend

return transposed zgsmatrix

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

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

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

Definition at line 57 of file zgsmatrix-calc.hpp.

58 {CPPL_VERBOSE_REPORT;
59  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
60  double vmax =0.;
61 
62  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
63  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
64  if( vmax < norm(it->v) ){
65  vmax =norm(it->v);
66  itx =it;
67  }
68  }
69 
70  i=itx->i;
71  j=itx->j;
72 }
_dgematrix i(const _dgbmatrix &mat)
friend _dgematrix i(const _dgematrix &)
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
comple damax ( const zgsmatrix mat)
friend

return its largest absolute value

Definition at line 76 of file zgsmatrix-calc.hpp.

77 {CPPL_VERBOSE_REPORT;
78  std::vector<zcomponent>::const_iterator itx(mat.data.begin());
79  double vmax =0.;
80 
81  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
82  for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){
83  if( vmax < norm(it->v) ){
84  vmax =norm(it->v);
85  itx =it;
86  }
87  }
88 
89  return itx->v;
90 }
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
const _zgsmatrix& operator+ ( const _zgsmatrix mat)
friend

+_zgsmatrix operator

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

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

-_zgsmatrix operator

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

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

_zgsmatrix+zgematrix operator

Definition at line 3 of file _zgsmatrix-zgematrix.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  zgematrix newmat(matB);
15 
16  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<zcomponent>::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: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator+ ( const _zgsmatrix matA,
const _zgematrix matB 
)
friend

_zgsmatrix+_zgematrix operator

Definition at line 3 of file _zgsmatrix-_zgematrix.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<zcomponent>::const_iterator matA_data_end =matA.data.end();
15  for(std::vector<zcomponent>::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 m
matrix row size
Definition: _zgematrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator+ ( const _zgsmatrix matA,
const zhematrix matB 
)
friend

_zgsmatrix+zhematrix operator

Definition at line 3 of file _zgsmatrix-zhematrix.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  zgematrix newmat( matB.to_zgematrix() );
15 
16  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<zcomponent>::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: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
_zgematrix to_zgematrix() const
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator+ ( const _zgsmatrix matA,
const _zhematrix matB 
)
friend

_zgsmatrix+_zhematrix operator

Definition at line 3 of file _zgsmatrix-_zhematrix.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  zgematrix newmat( matB.to_zgematrix() );
15 
16  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
17  for(std::vector<zcomponent>::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 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
void destroy() const
_zgematrix to_zgematrix() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator+ ( const _zgsmatrix matA,
const zgbmatrix matB 
)
friend

_zgsmatrix+zgbmatrix operator

Definition at line 3 of file _zgsmatrix-zgbmatrix.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  zgematrix newmat( matA.to_zgematrix() );
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 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix to_zgematrix() const
_dcovector _(dcovector &vec)
_zgematrix operator+ ( const _zgsmatrix matA,
const _zgbmatrix matB 
)
friend

_zgsmatrix+_zgbmatrix operator

Definition at line 3 of file _zgsmatrix-_zgbmatrix.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  zgematrix newmat( matA.to_zgematrix() );
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: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
void destroy() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
_zgematrix to_zgematrix() const
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgsmatrix operator+ ( const _zgsmatrix matA,
const zgsmatrix matB 
)
friend

_zgsmatrix+zgsmatrix operator

Definition at line 3 of file _zgsmatrix-zgsmatrix.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  zgsmatrix newmat(matA);
15 
16  const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end();
17  for(std::vector<zcomponent>::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 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgsmatrix operator+ ( const _zgsmatrix matA,
const _zgsmatrix matB 
)
friend

_zgsmatrix+_zgsmatrix operator

Definition at line 3 of file _zgsmatrix-_zgsmatrix.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  zgsmatrix newmat(matA);
15 
16  const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end();
17  for(std::vector<zcomponent>::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 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgsmatrix operator+ ( const _zgsmatrix ,
const zhsmatrix  
)
friend
_zgsmatrix operator+ ( const _zgsmatrix ,
const _zhsmatrix  
)
friend
_zgematrix operator- ( const _zgsmatrix matA,
const zgematrix matB 
)
friend

_zgsmatrix-zgematrix operator

Definition at line 27 of file _zgsmatrix-zgematrix.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  zgematrix newmat(-matB);
39 
40  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
41  for(std::vector<zcomponent>::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: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const _zgsmatrix matA,
const _zgematrix matB 
)
friend

_zgsmatrix-_zgematrix operator

Definition at line 25 of file _zgsmatrix-_zgematrix.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.n << "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  //// add ////
42  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
43  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
44  matB(it->i,it->j) += it->v;
45  }
46 
47  matA.destroy();
48  return matB;
49 }
CPPL_INT m
matrix row size
Definition: _zgematrix.hpp:9
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
comple * array
1D array to store matrix data
Definition: _zgematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgematrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const _zgsmatrix matA,
const zhematrix matB 
)
friend

_zgsmatrix-zhematrix operator

Definition at line 27 of file _zgsmatrix-zhematrix.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  //// shallow copy to zgematrix ////
39  zgematrix newmat( (-matB).to_zgematrix() );
40 
41  //// add ////
42  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
43  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
44  newmat(it->i,it->j) += it->v;
45  }
46 
47  //// return ////
48  matA.destroy();
49  return _(newmat);
50 }
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT n
matrix column size
Definition: zhematrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
_zgematrix to_zgematrix() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const _zgsmatrix matA,
const _zhematrix matB 
)
friend

_zgsmatrix-_zhematrix operator

Definition at line 28 of file _zgsmatrix-_zhematrix.hpp.

29 {CPPL_VERBOSE_REPORT;
30 #ifdef CPPL_DEBUG
31  if(matA.m!=matB.n || 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.n << "x" << matB.n << ")." << std::endl;
35  exit(1);
36  }
37 #endif//CPPL_DEBUG
38 
39  //// shallow copy to zgematrix ////
40  zgematrix newmat( (-matB).to_zgematrix() );
41 
42  //// add ////
43  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
44  for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){
45  newmat(it->i,it->j) += it->v;
46  }
47 
48  ////////
49  matA.destroy();
50  matB.destroy();
51  return _(newmat);
52 }
CPPL_INT n
matrix column size
Definition: _zhematrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
void destroy() const
_zgematrix to_zgematrix() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator- ( const _zgsmatrix matA,
const zgbmatrix matB 
)
friend

_zgsmatrix-zgbmatrix operator

Definition at line 29 of file _zgsmatrix-zgbmatrix.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  zgematrix newmat( matA.to_zgematrix() );
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 }
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_zgematrix to_zgematrix() const
_dcovector _(dcovector &vec)
_zgematrix operator- ( const _zgsmatrix matA,
const _zgbmatrix matB 
)
friend

_zgsmatrix-_zgbmatrix operator

Definition at line 30 of file _zgsmatrix-_zgbmatrix.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  zgematrix newmat( matA.to_zgematrix() );
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: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
void destroy() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
_zgematrix to_zgematrix() const
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgsmatrix operator- ( const _zgsmatrix matA,
const zgsmatrix matB 
)
friend

_zgsmatrix-zgsmatrix operator

Definition at line 26 of file _zgsmatrix-zgsmatrix.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  zgsmatrix newmat(matA);
38 
39  const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end();
40  for(std::vector<zcomponent>::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 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_dcovector _(dcovector &vec)
_zgsmatrix operator- ( const _zgsmatrix matA,
const _zgsmatrix matB 
)
friend

_zgsmatrix-_zgsmatrix operator

Definition at line 27 of file _zgsmatrix-_zgsmatrix.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  zgsmatrix newmat(matA);
39 
40  const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end();
41  for(std::vector<zcomponent>::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 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgsmatrix operator- ( const _zgsmatrix ,
const zhsmatrix  
)
friend
_zgsmatrix operator- ( const _zgsmatrix ,
const _zhsmatrix  
)
friend
_zcovector operator* ( const _zgsmatrix mat,
const zcovector vec 
)
friend

_zgsmatrix*zcovector operator

Definition at line 3 of file _zgsmatrix-zcovector.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  zcovector newvec(mat.m);
15  newvec.zero();
16 
17  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
18  for(std::vector<zcomponent>::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 l
vector size
Definition: zcovector.hpp:9
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zcovector operator* ( const _zgsmatrix mat,
const _zcovector vec 
)
friend

_zgsmatrix*_zcovector operator

Definition at line 3 of file _zgsmatrix-_zcovector.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  zcovector newvec(mat.m);
15  newvec.zero();
16 
17  const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end();
18  for(std::vector<zcomponent>::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 n
matrix column size
Definition: _zgsmatrix.hpp:10
void destroy() const
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
CPPL_INT l
vector size
Definition: _zcovector.hpp:9
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator* ( const _zgsmatrix matA,
const zgematrix matB 
)
friend

_zgsmatrix*zgematrix operator

Definition at line 51 of file _zgsmatrix-zgematrix.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  zgematrix newmat(matA.m, matB.n);
63  newmat.zero();
64 
65  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
66  for(std::vector<zcomponent>::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 n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgematrix.hpp:10
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: zgematrix.hpp:9
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator* ( const _zgsmatrix matA,
const _zgematrix matB 
)
friend

_zgsmatrix*_zgematrix operator

Definition at line 53 of file _zgsmatrix-_zgematrix.hpp.

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

_zgsmatrix*zhematrix operator

Definition at line 54 of file _zgsmatrix-zhematrix.hpp.

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

_zgsmatrix*_zhematrix operator

Definition at line 56 of file _zgsmatrix-_zhematrix.hpp.

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

_zgsmatrix*zgbmatrix operator

Definition at line 55 of file _zgsmatrix-zgbmatrix.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  zgematrix newmat( matA.m, matB.n );
67  newmat.zero();
68 
69  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
70  for(std::vector<zcomponent>::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 n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgematrix operator* ( const _zgsmatrix matA,
const _zgbmatrix matB 
)
friend

_zgsmatrix*_zgbmatrix operator

Definition at line 57 of file _zgsmatrix-_zgbmatrix.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  zgematrix newmat( matA.m, matB.n );
69  newmat.zero();
70 
71  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
72  for(std::vector<zcomponent>::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: _zgbmatrix.hpp:12
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
void destroy() const
Complex Double-precision General Dence Matrix Class.
Definition: zgematrix.hpp:3
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgsmatrix operator* ( const _zgsmatrix matA,
const zgsmatrix matB 
)
friend

_zgsmatrix*zgsmatrix operator

Definition at line 49 of file _zgsmatrix-zgsmatrix.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  zgsmatrix newmat(matA.m, matB.n);
61 
62  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
63  for(std::vector<zcomponent>::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 }
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: zgsmatrix.hpp:12
std::vector< zcomponent > data
matrix data
Definition: zgsmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
CPPL_INT m
matrix row size
Definition: zgsmatrix.hpp:9
CPPL_INT n
matrix column size
Definition: zgsmatrix.hpp:10
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgsmatrix operator* ( const _zgsmatrix matA,
const _zgsmatrix matB 
)
friend

_zgsmatrix*_zgsmatrix operator

Definition at line 51 of file _zgsmatrix-_zgsmatrix.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  zgsmatrix newmat(matA.m, matB.n);
63 
64  const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end();
65  for(std::vector<zcomponent>::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 }
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _zgsmatrix.hpp:12
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT n
matrix column size
Definition: _zgsmatrix.hpp:10
CPPL_INT m
matrix row size
Definition: _zgsmatrix.hpp:9
void destroy() const
_dcovector _(dcovector &vec)
std::vector< zcomponent > data
matrix data
Definition: _zgsmatrix.hpp:11
_zgsmatrix operator* ( const _zgsmatrix ,
const zhsmatrix  
)
friend
_zgsmatrix operator* ( const _zgsmatrix ,
const _zhsmatrix  
)
friend
_zgsmatrix operator* ( const _zgsmatrix mat,
const double &  d 
)
friend

_zgsmatrix*double operator

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

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

_zgsmatrix*comple operator

Definition at line 3 of file _zgsmatrix-complex.hpp.

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

_zgsmatrix/double operator

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

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

_zgsmatrix/comple operator

Definition at line 15 of file _zgsmatrix-complex.hpp.

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

double*_zgsmatrix operator

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

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

complex*_zgsmatrix operator

Definition at line 3 of file complex-_zgsmatrix.hpp.

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

Member Data Documentation

CPPL_INT _zgsmatrix::m
mutable
CPPL_INT _zgsmatrix::n
mutable
std::vector<zcomponent> _zgsmatrix::data
mutable
std::vector< std::vector<CPPL_INT> > _zgsmatrix::rows
mutable

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

Definition at line 12 of file _zgsmatrix.hpp.

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

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

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

Definition at line 13 of file _zgsmatrix.hpp.

Referenced by _(), _zgsmatrix(), destroy(), nullify(), zgsmatrix::shallow_copy(), t(), zgsmatrix::zgsmatrix(), and ~_zgsmatrix().


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