CPPLapack
 All Classes Files Functions Variables Friends Pages
zhecomplex.hpp
Go to the documentation of this file.
1 //=============================================================================
2 //! (DO NOT USE) Complex-double Class for Hermitian matrices
3 class zhecomplex : public comple
4 {
5 public:
6  ///////////////////////////////////////////////
7  /////////////////// objects ///////////////////
8  ///////////////////////////////////////////////
9  CPPL_INT i, j;
10  comple& v;
11 
12  ///////////////////////////////////////////////
13  ///////////////// constructors ////////////////
14  ///////////////////////////////////////////////
15  inline zhecomplex(const CPPL_INT&, const CPPL_INT&, comple&);
16 
17  ///////////////////////////////////////////////
18  ////////////////// functions //////////////////
19  ///////////////////////////////////////////////
20  inline zhecomplex& operator=(const comple&);
21  inline zhecomplex& operator+=(const comple&);
22  inline zhecomplex& operator-=(const comple&);
23  inline zhecomplex& operator*=(const comple&);
24 };
25 
26 ///////////////////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////////////////
28 ///////////////////////////////////////////////////////////////////////////////
29 
30 //=============================================================================
31 /*! constructor */
32 inline zhecomplex::zhecomplex(const CPPL_INT& _i, const CPPL_INT& _j, comple& _v)
33  : comple( _i < _j ? std::conj( _v ) : _v ),
34  v( _v )
35 {CPPL_VERBOSE_REPORT;
36  i = _i;
37  j = _j;
38 }
39 
40 ///////////////////////////////////////////////////////////////////////////////
41 ///////////////////////////////////////////////////////////////////////////////
42 ///////////////////////////////////////////////////////////////////////////////
43 
44 //=============================================================================
45 /*! operator= */
46 inline zhecomplex& zhecomplex::operator=(const comple& _v)
47 {CPPL_VERBOSE_REPORT;
48 #ifdef CPPL_DEBUG
49  if( i==j && std::fabs(_v.imag()) > DBL_MIN ){
50  WARNING_REPORT;
51  std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl
52  << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl;
53  }
54 #endif//CPPL_DEBUG
55 
56  //comple::operator=( _v );
57  //v = ( i < j ? std::conj( _v ) : _v );
58  if(i>=j){
59  v =_v;
60  }
61  else{//i<j
62  v =std::conj(_v);
63  }
64  return *this;
65 }
66 
67 //=============================================================================
68 /*! operator+= */
69 inline zhecomplex& zhecomplex::operator+=(const comple& _v)
70 {CPPL_VERBOSE_REPORT;
71 #ifdef CPPL_DEBUG
72  if( i==j && std::fabs(_v.imag()) > DBL_MIN ){
73  WARNING_REPORT;
74  std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl
75  << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl;
76  }
77 #endif//CPPL_DEBUG
78 
79  if(i>=j){
80  v +=_v;
81  }
82  else{//i<j
83  v +=std::conj(_v);
84  }
85  return *this;
86 }
87 
88 //=============================================================================
89 /*! operator-= */
90 inline zhecomplex& zhecomplex::operator-=(const comple& _v)
91 {CPPL_VERBOSE_REPORT;
92 #ifdef CPPL_DEBUG
93  if( i==j && std::fabs(_v.imag()) > DBL_MIN ){
94  WARNING_REPORT;
95  std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl
96  << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl;
97  }
98 #endif//CPPL_DEBUG
99 
100  if(i>=j){
101  v -=_v;
102  }
103  else{//i<j
104  v -=std::conj(_v);
105  }
106  return *this;
107 }
108 
109 //=============================================================================
110 /*! operator*= */
111 inline zhecomplex& zhecomplex::operator*=(const comple& _v)
112 {CPPL_VERBOSE_REPORT;
113 #ifdef CPPL_DEBUG
114  if( i==j && std::fabs(_v.imag()) > DBL_MIN ){
115  WARNING_REPORT;
116  std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl
117  << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl;
118  }
119 #endif//CPPL_DEBUG
120 
121  if(i>=j){
122  v *=_v;
123  }
124  else{//i<j
125  v *=std::conj(_v);
126  }
127  return *this;
128 }
CPPL_INT j
Definition: zhecomplex.hpp:9
zhecomplex & operator=(const comple &)
Definition: zhecomplex.hpp:46
zhecomplex & operator-=(const comple &)
Definition: zhecomplex.hpp:90
_zcovector conj(const _zcovector &vec)
zhecomplex(const CPPL_INT &, const CPPL_INT &, comple &)
Definition: zhecomplex.hpp:32
(DO NOT USE) Complex-double Class for Hermitian matrices
Definition: zhecomplex.hpp:3
comple & v
Definition: zhecomplex.hpp:10
zhecomplex & operator+=(const comple &)
Definition: zhecomplex.hpp:69
zhecomplex & operator*=(const comple &)
Definition: zhecomplex.hpp:111
CPPL_INT i
Definition: zhecomplex.hpp:9