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

(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class More...

#include <_zhsmatrix.hpp>

Public Member Functions

 _zhsmatrix ()
 
 _zhsmatrix (const _zhsmatrix &)
 
 ~_zhsmatrix ()
 
_zgematrix to_zgematrix () const
 
_zhematrix to_zhematrix () const
 
_zgsmatrix to_zgsmatrix () 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 const & m
 matrix row size More...
 
CPPL_INT n
 matrix column size More...
 
std::vector< zcomponentdata
 matrix data More...
 
std::vector< std::vector
< CPPL_INT > > 
line
 vector of vector to store the entry information of component for each row and column More...
 

Friends

std::ostream & operator<< (std::ostream &, const _zhsmatrix &)
 
_zhsmatrix t (const zhsmatrix &)
 
void idamax (CPPL_INT &, CPPL_INT &, const zhsmatrix &)
 
comple damax (const zhsmatrix &)
 
const _zhsmatrixoperator+ (const _zhsmatrix &)
 
_zhsmatrix operator- (const _zhsmatrix &)
 
_zgematrix operator+ (const _zhsmatrix &, const zgematrix &)
 
_zgematrix operator+ (const _zhsmatrix &, const _zgematrix &)
 
_zgematrix operator+ (const _zhsmatrix &, const zhematrix &)
 
_zgematrix operator+ (const _zhsmatrix &, const _zhematrix &)
 
_zgematrix operator+ (const _zhsmatrix &, const zgbmatrix &)
 
_zgematrix operator+ (const _zhsmatrix &, const _zgbmatrix &)
 
_zgsmatrix operator+ (const _zhsmatrix &, const zgsmatrix &)
 
_zgsmatrix operator+ (const _zhsmatrix &, const _zgsmatrix &)
 
_zhsmatrix operator+ (const _zhsmatrix &, const zhsmatrix &)
 
_zhsmatrix operator+ (const _zhsmatrix &, const _zhsmatrix &)
 
_zgematrix operator- (const _zhsmatrix &, const zgematrix &)
 
_zgematrix operator- (const _zhsmatrix &, const _zgematrix &)
 
_zgematrix operator- (const _zhsmatrix &, const zhematrix &)
 
_zgematrix operator- (const _zhsmatrix &, const _zhematrix &)
 
_zgematrix operator- (const _zhsmatrix &, const zgbmatrix &)
 
_zgematrix operator- (const _zhsmatrix &, const _zgbmatrix &)
 
_zgsmatrix operator- (const _zhsmatrix &, const zgsmatrix &)
 
_zgsmatrix operator- (const _zhsmatrix &, const _zgsmatrix &)
 
_zhsmatrix operator- (const _zhsmatrix &, const zhsmatrix &)
 
_zhsmatrix operator- (const _zhsmatrix &, const _zhsmatrix &)
 
_zcovector operator* (const _zhsmatrix &, const zcovector &)
 
_zcovector operator* (const _zhsmatrix &, const _zcovector &)
 
_zgematrix operator* (const _zhsmatrix &, const zgematrix &)
 
_zgematrix operator* (const _zhsmatrix &, const _zgematrix &)
 
_zgematrix operator* (const _zhsmatrix &, const zhematrix &)
 
_zgematrix operator* (const _zhsmatrix &, const _zhematrix &)
 
_zgematrix operator* (const _zhsmatrix &, const zgbmatrix &)
 
_zgematrix operator* (const _zhsmatrix &, const _zgbmatrix &)
 
_zgsmatrix operator* (const _zhsmatrix &, const zgsmatrix &)
 
_zgsmatrix operator* (const _zhsmatrix &, const _zgsmatrix &)
 
_zgsmatrix operator* (const _zhsmatrix &, const zhsmatrix &)
 
_zgsmatrix operator* (const _zhsmatrix &, const _zhsmatrix &)
 
_zhsmatrix operator* (const _zhsmatrix &, const double &)
 
_zgsmatrix operator* (const _zhsmatrix &, const comple &)
 
_zhsmatrix operator/ (const _zhsmatrix &, const double &)
 
_zgsmatrix operator/ (const _zhsmatrix &, const comple &)
 
_zhsmatrix operator* (const double &, const _zhsmatrix &)
 
_zgsmatrix operator* (const comple &, const _zhsmatrix &)
 

Detailed Description

(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class

Definition at line 3 of file _zhsmatrix.hpp.

Constructor & Destructor Documentation

_zhsmatrix::_zhsmatrix ( )
inline

_zhsmatrix constructor without arguments

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

References data, line, and n.

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

_zhsmatrix copy constructor

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

References data, line, n, and nullify().

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

_zhsmatrix destructor

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

References data, and line.

32 {CPPL_VERBOSE_REPORT;
33  data.clear();
34  line.clear();
35 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
Definition: _zhsmatrix.hpp:13

Member Function Documentation

_zgematrix _zhsmatrix::to_zgematrix ( ) const
inline

convert to _zgematrix

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

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

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

convert to _zhematrix

Definition at line 19 of file _zhsmatrix-cast.hpp.

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

20 {CPPL_VERBOSE_REPORT;
21  zhematrix newmat(n);
22  newmat.zero();
23 
24  const std::vector<zcomponent>::const_iterator data_end =data.end();
25  for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
26  newmat(it->i, it->j) =it->v;
27  }
28 
29  destroy();
30  return _(newmat);
31 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
void destroy() const
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage].
Definition: zhematrix.hpp:4
_dcovector _(dcovector &vec)
_zgsmatrix _zhsmatrix::to_zgsmatrix ( ) const
inline

convert to _zgsmatrix

Definition at line 35 of file _zhsmatrix-cast.hpp.

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

Referenced by operator*(), and operator/().

36 {CPPL_VERBOSE_REPORT;
37  zgsmatrix newmat(m,n);
38  newmat.zero();
39 
40  const std::vector<zcomponent>::const_iterator data_end =data.end();
41  for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
42  newmat.put(it->i, it->j, it->v);
43  if(it->i!=it->j){
44  newmat.put(it->j, it->i, std::conj(it->v));
45  }
46  }
47 
48  destroy();
49  return _(newmat);
50 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
CPPL_INT const & m
matrix row size
Definition: _zhsmatrix.hpp:10
void destroy() const
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
_dcovector _(dcovector &vec)
comple _zhsmatrix::operator() ( const CPPL_INT &  i,
const CPPL_INT &  j 
) const
inline

operator() for const object

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

References conj(), data, line, and n.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if( i<0 || j<0 || n<=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 " << n << "x" << n << "." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  //// search (i,j) component ////
15  const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
16 
17  const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end();
18  for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){
19  if(data[*p].j==jj){
20  if( i>j ){ return data[*p].v; }//ii=i
21  else{ return std::conj(data[*p].v); }//ii=j
22  }
23  }
24 
25  //// (i,j) component was not found ////
26  return comple(0.0,0.0);
27 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
_dgematrix i(const _dgbmatrix &mat)
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
Definition: _zhsmatrix.hpp:13
void _zhsmatrix::write ( const char *  filename) const
inline

Definition at line 69 of file _zhsmatrix-io.hpp.

References data, destroy(), and n.

70 {CPPL_VERBOSE_REPORT;
71  std::ofstream ofs(filename, std::ios::trunc);
72  ofs.setf(std::cout.flags());
73  ofs.precision(std::cout.precision());
74  ofs.width(std::cout.width());
75  ofs.fill(std::cout.fill());
76 
77  ofs << "#zhsmatrix " << n << " " << data.size() << std::endl;
78 
79  const std::vector<zcomponent>::const_iterator data_end =data.end();
80  for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
81  ofs << it->i << " " << it->j << " " << it->v << std::endl;
82  }
83 
84  ofs.close();
85  destroy();
86 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
void destroy() const
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
void _zhsmatrix::nullify ( ) const
inline

nullify all the matrix data

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

References data, line, and n.

Referenced by _zhsmatrix(), zhsmatrix::shallow_copy(), and zhsmatrix::zhsmatrix().

4 {CPPL_VERBOSE_REPORT;
5  n=0;
6  data.clear();
7  line.clear();
8 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
Definition: _zhsmatrix.hpp:13
void _zhsmatrix::destroy ( ) const
inline

destroy all the matrix data

Definition at line 12 of file _zhsmatrix-misc.hpp.

References data, and line.

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

13 {CPPL_VERBOSE_REPORT;
14  data.clear();
15  line.clear();
16 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
Definition: _zhsmatrix.hpp:13

Friends And Related Function Documentation

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

Definition at line 34 of file _zhsmatrix-io.hpp.

35 {CPPL_VERBOSE_REPORT;
36  for(CPPL_INT i=0; i<mat.n; i++){
37  for(CPPL_INT j=0; j<mat.n; j++){
38  if( i >= j ){
39  std::vector<CPPL_INT>::iterator q;
40  const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.line[i].end();
41  for(q=mat.line[i].begin(); q!=mat_line_i_end; q++){
42  if( mat.data[*q].j==j ){ break; }
43  }
44  if(q!=mat_line_i_end){ s << " " << mat.data[*q].v << " "; }
45  else{ s << " x "; }
46  }
47  else{//i<j
48  std::vector<CPPL_INT>::iterator q;
49  const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.line[i].end();
50  for(q=mat.line[i].begin(); q!=mat_line_i_end; q++){
51  if( mat.data[*q].j==j ){ break; }
52  }
53  if(q!=mat_line_i_end){ s << "{" << mat.data[*q].v << "}"; }
54  else{ s << "{x}"; }
55  }
56  }
57  s << std::endl;
58  }
59 
60  mat.destroy();
61  return s;
62 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
void destroy() const
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
Definition: _zhsmatrix.hpp:13
_zhsmatrix t ( const zhsmatrix mat)
friend

return transposed zhsmatrix

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

4 {CPPL_VERBOSE_REPORT;
5  zhsmatrix newmat(mat);
6 
7  const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end();
8  for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){
9  it->v =std::conj(it->v);
10  }
11 
12  return _(newmat);
13 }
_zhsmatrix conj(const zhsmatrix &mat)
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
void idamax ( CPPL_INT &  i,
CPPL_INT &  j,
const zhsmatrix mat 
)
friend

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

Definition at line 53 of file zhsmatrix-calc.hpp.

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

return its largest absolute value

Definition at line 72 of file zhsmatrix-calc.hpp.

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

+_zhsmatrix operator

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

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

-_zhsmatrix operator

Definition at line 10 of file _zhsmatrix-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: _zhsmatrix.hpp:12
_zgematrix operator+ ( const _zhsmatrix ,
const zgematrix  
)
friend
_zgematrix operator+ ( const _zhsmatrix ,
const _zgematrix  
)
friend
_zgematrix operator+ ( const _zhsmatrix ,
const zhematrix  
)
friend
_zgematrix operator+ ( const _zhsmatrix ,
const _zhematrix  
)
friend
_zgematrix operator+ ( const _zhsmatrix ,
const zgbmatrix  
)
friend
_zgematrix operator+ ( const _zhsmatrix ,
const _zgbmatrix  
)
friend
_zgsmatrix operator+ ( const _zhsmatrix ,
const zgsmatrix  
)
friend
_zgsmatrix operator+ ( const _zhsmatrix ,
const _zgsmatrix  
)
friend
_zhsmatrix operator+ ( const _zhsmatrix matA,
const zhsmatrix matB 
)
friend

_zhsmatrix+zhsmatrix operator

Definition at line 3 of file _zhsmatrix-zhsmatrix.hpp.

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(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.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zhsmatrix 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 }
CPPL_INT n
matrix column size
Definition: zhsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< zcomponent > data
matrix data
Definition: zhsmatrix.hpp:11
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
_zhsmatrix operator+ ( const _zhsmatrix matA,
const _zhsmatrix matB 
)
friend

_zhsmatrix+_zhsmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5 #ifdef CPPL_DEBUG
6  if(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.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zhsmatrix 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 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
void destroy() const
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
_zgematrix operator- ( const _zhsmatrix ,
const zgematrix  
)
friend
_zgematrix operator- ( const _zhsmatrix ,
const _zgematrix  
)
friend
_zgematrix operator- ( const _zhsmatrix ,
const zhematrix  
)
friend
_zgematrix operator- ( const _zhsmatrix ,
const _zhematrix  
)
friend
_zgematrix operator- ( const _zhsmatrix ,
const zgbmatrix  
)
friend
_zgematrix operator- ( const _zhsmatrix ,
const _zgbmatrix  
)
friend
_zgsmatrix operator- ( const _zhsmatrix ,
const zgsmatrix  
)
friend
_zgsmatrix operator- ( const _zhsmatrix ,
const _zgsmatrix  
)
friend
_zhsmatrix operator- ( const _zhsmatrix matA,
const zhsmatrix matB 
)
friend

_zhsmatrix-zhsmatrix operator

Definition at line 26 of file _zhsmatrix-zhsmatrix.hpp.

27 {CPPL_VERBOSE_REPORT;
28 #ifdef CPPL_DEBUG
29  if(matA.n!=matB.n){
30  ERROR_REPORT;
31  std::cerr << "These two matrises can not make a subtraction." << std::endl
32  << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
33  exit(1);
34  }
35 #endif//CPPL_DEBUG
36 
37  zhsmatrix 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 }
CPPL_INT n
matrix column size
Definition: zhsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
std::vector< zcomponent > data
matrix data
Definition: zhsmatrix.hpp:11
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
_zhsmatrix operator- ( const _zhsmatrix matA,
const _zhsmatrix matB 
)
friend

_zhsmatrix-_zhsmatrix operator

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

28 {CPPL_VERBOSE_REPORT;
29 #ifdef CPPL_DEBUG
30  if(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.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl;
34  exit(1);
35  }
36 #endif//CPPL_DEBUG
37 
38  zhsmatrix 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 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
void destroy() const
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dcovector _(dcovector &vec)
_zcovector operator* ( const _zhsmatrix mat,
const zcovector vec 
)
friend

_zhsmatrix*zcovector operator

Definition at line 3 of file _zhsmatrix-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.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.n);
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  if(it->i!=it->j){
21  newvec(it->j) +=std::conj(it->v)*vec(it->i);
22  }
23  }
24 
25  mat.destroy();
26  return _(newvec);
27 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
CPPL_INT l
vector size
Definition: zcovector.hpp:9
void destroy() const
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
Complex Double-precision Column Vector Class.
Definition: zcovector.hpp:3
_dcovector _(dcovector &vec)
_zcovector operator* ( const _zhsmatrix mat,
const _zcovector vec 
)
friend

_zhsmatrix*_zcovector operator

Definition at line 3 of file _zhsmatrix-_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.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl;
10  exit(1);
11  }
12 #endif//CPPL_DEBUG
13 
14  zcovector newvec(mat.n);
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  if(it->i!=it->j){
21  newvec(it->j) +=std::conj(it->v)*vec(it->i);
22  }
23  }
24 
25  mat.destroy();
26  vec.destroy();
27  return _(newvec);
28 }
std::vector< zcomponent > data
matrix data
Definition: _zhsmatrix.hpp:12
void destroy() const
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Definition: _zhsmatrix.hpp:11
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)
_zgematrix operator* ( const _zhsmatrix ,
const zgematrix  
)
friend
_zgematrix operator* ( const _zhsmatrix ,
const _zgematrix  
)
friend
_zgematrix operator* ( const _zhsmatrix ,
const zhematrix  
)
friend
_zgematrix operator* ( const _zhsmatrix ,
const _zhematrix  
)
friend
_zgematrix operator* ( const _zhsmatrix ,
const zgbmatrix  
)
friend
_zgematrix operator* ( const _zhsmatrix ,
const _zgbmatrix  
)
friend
_zgsmatrix operator* ( const _zhsmatrix ,
const zgsmatrix  
)
friend
_zgsmatrix operator* ( const _zhsmatrix ,
const _zgsmatrix  
)
friend
_zgsmatrix operator* ( const _zhsmatrix ,
const zhsmatrix  
)
friend
_zgsmatrix operator* ( const _zhsmatrix ,
const _zhsmatrix  
)
friend
_zhsmatrix operator* ( const _zhsmatrix mat,
const double &  d 
)
friend

_zhsmatrix*double operator

Definition at line 3 of file _zhsmatrix-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: _zhsmatrix.hpp:12
_zgsmatrix operator* ( const _zhsmatrix mat,
const comple &  d 
)
friend

_zhsmatrix*comple operator

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

4 {CPPL_VERBOSE_REPORT;
5  zgsmatrix newmat( mat.to_zgsmatrix() );
6  return newmat*d;
7 }
_zgsmatrix to_zgsmatrix() const
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
_zhsmatrix operator/ ( const _zhsmatrix mat,
const double &  d 
)
friend

_zhsmatrix/double operator

Definition at line 15 of file _zhsmatrix-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: _zhsmatrix.hpp:12
_zgsmatrix operator/ ( const _zhsmatrix mat,
const comple &  d 
)
friend

_zhsmatrix/comple operator

Definition at line 11 of file _zhsmatrix-complex.hpp.

12 {CPPL_VERBOSE_REPORT;
13  zgsmatrix newmat( mat.to_zgsmatrix() );
14  return newmat/d;
15 }
_zgsmatrix to_zgsmatrix() const
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3
_zhsmatrix operator* ( const double &  d,
const _zhsmatrix mat 
)
friend

double*_zhsmatrix operator

Definition at line 3 of file double-_zhsmatrix.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: _zhsmatrix.hpp:12
_zgsmatrix operator* ( const comple &  d,
const _zhsmatrix mat 
)
friend

complex*_zhsmatrix operator

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

4 {CPPL_VERBOSE_REPORT;
5  zgsmatrix newmat =mat.to_zgsmatrix();
6  return d*newmat;
7 }
_zgsmatrix to_zgsmatrix() const
Complex Double-precision General Sparse Matrix Class.
Definition: zgsmatrix.hpp:3

Member Data Documentation

CPPL_INT const& _zhsmatrix::m

matrix row size

Definition at line 10 of file _zhsmatrix.hpp.

Referenced by operator*(), to_zgematrix(), and to_zgsmatrix().

CPPL_INT _zhsmatrix::n
mutable
std::vector<zcomponent> _zhsmatrix::data
mutable
std::vector< std::vector<CPPL_INT> > _zhsmatrix::line
mutable

vector of vector to store the entry information of component for each row and column

Definition at line 13 of file _zhsmatrix.hpp.

Referenced by _(), _zhsmatrix(), destroy(), nullify(), operator()(), operator<<(), zhsmatrix::shallow_copy(), zhsmatrix::zhsmatrix(), and ~_zhsmatrix().


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