00001
00003 class __zhecomplex : public std::complex<double>
00004 {
00005 private:
00007 std::complex<double>& value;
00008 int i, j;
00009
00010 public:
00012 inline __zhecomplex(std::complex<double>& _value, const int& _i, const int& _j)
00013 : std::complex<double>( _i < _j ? std::conj( _value ) : _value ),
00014 value( _value )
00015 {
00016 #ifdef CPPL_VERBOSE
00017 std::cerr << "# [MARK] __zhecomplex(const std::complex<double>&, const int&, const int&)"
00018 << std::endl;
00019 #endif//CPPL_VERBOSE
00020
00021 i = _i;
00022 j = _j;
00023 }
00024
00026 inline __zhecomplex& operator=(const std::complex<double>& _value)
00027 {
00028 #ifdef CPPL_VERBOSE
00029 std::cerr << "# [MARK] operator=(const std::complex<double>&)"
00030 << std::endl;
00031 #endif//CPPL_VERBOSE
00032
00033 #ifdef CPPL_DEBUG
00034 if( i==j && std::fabs(_value.imag()) > CPPL_EPS ){
00035 std::cerr << "[WARNING] __zhecomplex::operator="
00036 << "(const std::complex<double>&)" << std::endl
00037 << "Diagonal components of a hermitian matrix "
00038 << "have to be real numbers." << std::endl
00039 << "Your input to the (" << i << "," << j << ") element "
00040 << "was a complex number, " << _value << "." << std::endl;
00041 }
00042 #endif//CPPL_DEBUG
00043
00044 std::complex<double>::operator=( _value );
00045 value = ( i < j ? std::conj( _value ) : _value );
00046 return *this;
00047 }
00048 };