Menu

[r108]: / trunk / include / __zhecomplex- / __zhecomplex.hpp  Maximize  Restore  History

Download this file

44 lines (38 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//=============================================================================
//! (DO NOT USE) Shaddow Complex-double Class for zhematrix
class __zhecomplex : public std::complex<double>
{
private:
//// objects ////
std::complex<double>& value;
int i, j;
public:
//// constructer ////
inline __zhecomplex(std::complex<double>& _value, const int& _i, const int& _j)
: std::complex<double>( _i < _j ? std::conj( _value ) : _value ),
value( _value )
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] __zhecomplex(const std::complex<double>&, const int&, const int&)" << std::endl;
#endif//CPPL_VERBOSE
i = _i;
j = _j;
}
//// operator= ////
inline __zhecomplex& operator=(const std::complex<double>& _value)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator=(const std::complex<double>&)" << std::endl;
#endif//CPPL_VERBOSE
//#ifdef CPPL_DEBUG
if( i==j && std::fabs(_value.imag()) > CPPL_EPS ){
std::cerr << "[WARNING] __zhecomplex::operator=(const std::complex<double>&)" << std::endl
<< "Diagonal components of a hermitian matrix have to be real numbers." << std::endl
<< "Your input to the (" << i << "," << j << ") element was a complex number, " << _value << "." << std::endl;
}
//#endif//CPPL_DEBUG
std::complex<double>::operator=( _value );
value = ( i < j ? std::conj( _value ) : _value );
return *this;
}
};
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.