Go to the documentation of this file.
23 #ifndef COM_DAFER45_TBTK_COMPLEX
24 #define COM_DAFER45_TBTK_COMPLEX
35 #if TBTK_WRAP_PRIMITIVE_TYPES
46 constexpr
Complex(std::complex<double> value) : value(value) {}
56 constexpr
Complex(
double value) : value(value) {}
67 constexpr
operator std::complex<double>()
const{
100 std::complex<double> &lhs,
177 Complex result(lhs - rhs.value.real(), -rhs.value.imag());
255 return value == rhs.value;
264 return value != rhs.value;
306 return real(complex.value);
315 return imag(complex.value);
324 return conj(complex.value);
333 return abs(complex.value);
337 std::complex<double> value;
341 const std::string &serialization,
345 case Serializable::Mode::JSON:
347 std::stringstream ss(serialization);
354 "Complex::Complex()",
355 "Only Serializable::Mode::JSON is supported yet.",
363 case Serializable::Mode::JSON:
365 std::stringstream ss;
372 "Complex::serialize()",
373 "Only Serializable::Mode::JSON is supported yet.",
380 typedef std::complex<double>
Complex;
friend Complex operator+(const Complex &lhs, const double &rhs)
Definition: Complex.h:114
friend std::ostream & operator<<(std::ostream &os, const Complex &complex)
Definition: Complex.h:273
Complex & operator/=(const Complex &rhs)
Definition: Complex.h:231
Boolean number.
Definition: Boolean.h:37
std::string serialize(Serializable::Mode mode) const
Definition: Complex.h:361
friend std::complex< double > & operator+=(std::complex< double > &lhs, const Complex &rhs)
Definition: Complex.h:99
Complex & operator*=(const Complex &rhs)
Definition: Complex.h:194
friend std::istream & operator>>(std::istream &is, Complex &complex)
Definition: Complex.h:285
Complex operator-(const Complex &rhs) const
Definition: Complex.h:150
Boolean operator!=(const Complex &rhs) const
Definition: Complex.h:263
friend Complex operator-(const double &lhs, const Complex &rhs)
Definition: Complex.h:176
Real number.
Definition: Real.h:33
Boolean operator==(const Complex &rhs) const
Definition: Complex.h:254
constexpr Complex(double value)
Definition: Complex.h:56
constexpr friend Real real(const Complex &complex)
Definition: Complex.h:305
friend Complex operator*(const Complex &lhs, const double &rhs)
Definition: Complex.h:206
friend Complex operator+(const double &lhs, const Complex &rhs)
Definition: Complex.h:127
Complex operator-() const
Definition: Complex.h:185
Complex & operator=(const std::complex< double > &rhs)
Definition: Complex.h:76
Complex number.
Definition: Complex.h:38
Complex & operator+=(const Complex &rhs)
Definition: Complex.h:87
constexpr friend Real imag(const Complex &complex)
Definition: Complex.h:314
constexpr Complex(Real real, Real imag)
Definition: Complex.h:51
friend Complex operator*(const double &lhs, const Complex &rhs)
Definition: Complex.h:219
friend Complex conj(const Complex &complex)
Definition: Complex.h:323
friend Complex operator/(const Complex &lhs, const double &rhs)
Definition: Complex.h:242
friend Real abs(const Complex &complex)
Definition: Complex.h:332
Complex()
Definition: Complex.h:41
Base class for psudo-serializable objects.
Complex & operator-=(const Complex &rhs)
Definition: Complex.h:139
Mode
Definition: Serializable.h:47
friend Complex operator-(const Complex &lhs, const double &rhs)
Definition: Complex.h:163
Definition: PseudoSerializable.h:31
constexpr Complex(std::complex< double > value)
Definition: Complex.h:46