My Project
__zhecomplex.hpp
1 //=============================================================================
3 class __zhecomplex : public std::complex<double>
4 {
5 private:
7  std::complex<double>& value;
8  int i, j;
9 
10 public:
12  inline __zhecomplex(std::complex<double>& _value, const int& _i, const int& _j)
13  : std::complex<double>( _i < _j ? std::conj( _value ) : _value ),
14  value( _value )
15  {
16 #ifdef CPPL_VERBOSE
17  std::cerr << "# [MARK] __zhecomplex(const std::complex<double>&, const int&, const int&)"
18  << std::endl;
19 #endif//CPPL_VERBOSE
20 
21  i = _i;
22  j = _j;
23  }
24 
26  inline __zhecomplex& operator=(const std::complex<double>& _value)
27  {
28 #ifdef CPPL_VERBOSE
29  std::cerr << "# [MARK] operator=(const std::complex<double>&)"
30  << std::endl;
31 #endif//CPPL_VERBOSE
32 
33 #ifdef CPPL_DEBUG
34  if( i==j && std::fabs(_value.imag()) > CPPL_EPS ){
35  std::cerr << "[WARNING] __zhecomplex::operator="
36  << "(const std::complex<double>&)" << std::endl
37  << "Diagonal components of a hermitian matrix "
38  << "have to be real numbers." << std::endl
39  << "Your input to the (" << i << "," << j << ") element "
40  << "was a complex number, " << _value << "." << std::endl;
41  }
42 #endif//CPPL_DEBUG
43 
44  std::complex<double>::operator=( _value );
45  value = ( i < j ? std::conj( _value ) : _value );
46  return *this;
47  }
48 };
(DO NOT USE) Shaddow Complex-double Class for zhematrix
Definition: __zhecomplex.hpp:3