PeriDyno 1.0.0
Loading...
Searching...
No Matches
Complex.h
Go to the documentation of this file.
1
16#pragma once
17#include "Platform.h"
18
19namespace dyno
20{
21 template <typename Real>
22 class Complex
23 {
24 public:
25 DYN_FUNC Complex();
26 DYN_FUNC explicit Complex(Real real, Real imag = Real(0));
27 DYN_FUNC Real realPart() const { return m_real; }
28 DYN_FUNC Real imagPart() const { return m_imag; }
29
30 DYN_FUNC Real& realPart() { return m_real; }
31 DYN_FUNC Real& imagPart() { return m_imag; }
32
33 DYN_FUNC Complex<Real> conjugate() const;
34 DYN_FUNC Real norm() const;
35 DYN_FUNC Real normSquared() const;
36
37 DYN_FUNC bool isReal() const;
38
39 DYN_FUNC const Complex<Real> operator+ (const Complex<Real> &other) const;
40 DYN_FUNC const Complex<Real> operator- (const Complex<Real> &other) const;
41 DYN_FUNC const Complex<Real> operator* (const Complex<Real> &other) const;
42 DYN_FUNC const Complex<Real> operator/ (const Complex<Real> &other) const;
43
44 DYN_FUNC Complex<Real>& operator+= (const Complex<Real> &other);
45 DYN_FUNC Complex<Real>& operator-= (const Complex<Real> &other);
46 DYN_FUNC Complex<Real>& operator*= (const Complex<Real> &other);
47 DYN_FUNC Complex<Real>& operator/= (const Complex<Real> &other);
48
49
50 DYN_FUNC Complex<Real>& operator= (const Complex<Real> &other);
51
52 DYN_FUNC bool operator== (const Complex<Real> &other) const;
53 DYN_FUNC bool operator!= (const Complex<Real> &other) const;
54
55 DYN_FUNC const Complex<Real> operator+ (const Real& real) const;
56 DYN_FUNC const Complex<Real> operator- (const Real& real) const;
57 DYN_FUNC const Complex<Real> operator* (const Real& real) const;
58 DYN_FUNC const Complex<Real> operator/ (const Real& real) const;
59
60 DYN_FUNC Complex<Real>& operator+= (const Real& real);
61 DYN_FUNC Complex<Real>& operator-= (const Real& real);
62 DYN_FUNC Complex<Real>& operator*= (const Real& real);
63 DYN_FUNC Complex<Real>& operator/= (const Real& real);
64
65 DYN_FUNC const Complex<Real> operator - (void) const;
66
67 protected:
70 };
71
72 template<typename Real> inline DYN_FUNC Complex<Real> acos(const Complex<Real>&);
73 template<typename Real> inline DYN_FUNC Complex<Real> asin(const Complex<Real>&);
74 template<typename Real> inline DYN_FUNC Complex<Real> atan(const Complex<Real>&);
75 template<typename Real> inline DYN_FUNC Complex<Real> asinh(const Complex<Real>&);
76 template<typename Real> inline DYN_FUNC Complex<Real> acosh(const Complex<Real>&);
77 template<typename Real> inline DYN_FUNC Complex<Real> atanh(const Complex<Real>&);
78 template<typename Real> inline DYN_FUNC Complex<Real> cos(const Complex<Real>&);
79 template<typename Real> inline DYN_FUNC Complex<Real> cosh(const Complex<Real>&);
80 template<typename Real> inline DYN_FUNC Complex<Real> exp(const Complex<Real>&);
81 template<typename Real> inline DYN_FUNC Complex<Real> log(const Complex<Real>&);
82 template<typename Real> inline DYN_FUNC Complex<Real> log10(const Complex<Real>&);
83
84 template<typename Real> inline DYN_FUNC Complex<Real> pow(const Complex<Real>&, const Real&);
85 template<typename Real> inline DYN_FUNC Complex<Real> pow(const Complex<Real>&, const Complex<Real>&);
86 template<typename Real> inline DYN_FUNC Complex<Real> pow(const Real&, const Complex<Real>&);
87 //
88 template<typename Real> inline DYN_FUNC Complex<Real> sin(const Complex<Real>&);
89 template<typename Real> inline DYN_FUNC Complex<Real> sinh(const Complex<Real>&);
90 template<typename Real> inline DYN_FUNC Complex<Real> sqrt(const Complex<Real>&);
91 template<typename Real> inline DYN_FUNC Complex<Real> tan(const Complex<Real>&);
92 template<typename Real> inline DYN_FUNC Complex<Real> tanh(const Complex<Real>&);
93
94 template<typename Real> inline DYN_FUNC Real arg(const Complex<Real>&);
95 template<typename Real> inline DYN_FUNC Complex<Real> polar(const Real& __rho, const Real& __theta = Real(0));
96}
97
98#include "Complex.inl"
double Real
Definition Typedef.inl:23
Real m_real
Definition Complex.h:68
DYN_FUNC const Complex< Real > operator+(const Complex< Real > &other) const
Definition Complex.inl:20
DYN_FUNC Real & imagPart()
Definition Complex.h:31
DYN_FUNC Real & realPart()
Definition Complex.h:30
DYN_FUNC bool operator==(const Complex< Real > &other) const
Definition Complex.inl:108
DYN_FUNC Real realPart() const
Definition Complex.h:27
DYN_FUNC Real normSquared() const
Definition Complex.inl:222
DYN_FUNC const Complex< Real > operator*(const Complex< Real > &other) const
Definition Complex.inl:36
DYN_FUNC Complex()
Definition Complex.inl:8
DYN_FUNC Real norm() const
Definition Complex.inl:215
DYN_FUNC Complex< Real > & operator/=(const Complex< Real > &other)
Definition Complex.inl:86
DYN_FUNC Complex< Real > & operator-=(const Complex< Real > &other)
Definition Complex.inl:68
DYN_FUNC const Complex< Real > operator-(void) const
Definition Complex.inl:197
DYN_FUNC const Complex< Real > operator/(const Complex< Real > &other) const
Definition Complex.inl:45
DYN_FUNC bool operator!=(const Complex< Real > &other) const
Definition Complex.inl:120
DYN_FUNC Real imagPart() const
Definition Complex.h:28
DYN_FUNC Complex< Real > & operator*=(const Complex< Real > &other)
DYN_FUNC Complex< Real > conjugate() const
Definition Complex.inl:207
DYN_FUNC bool isReal() const
Definition Complex.inl:229
DYN_FUNC Complex< Real > & operator=(const Complex< Real > &other)
Definition Complex.inl:98
DYN_FUNC Complex< Real > & operator+=(const Complex< Real > &other)
Definition Complex.inl:60
Real m_imag
Definition Complex.h:69
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
DYN_FUNC Complex< Real > cosh(const Complex< Real > &)
Definition Complex.inl:410
DYN_FUNC Real arg(const Complex< Real > &)
Definition Complex.inl:273
DYN_FUNC Complex< Real > atanh(const Complex< Real > &)
Definition Complex.inl:458
DYN_FUNC Complex< Real > tanh(const Complex< Real > &)
Definition Complex.inl:491
DYN_FUNC Complex< Real > log(const Complex< Real > &)
Definition Complex.inl:305
DYN_FUNC Complex< Real > sin(const Complex< Real > &)
Definition Complex.inl:564
DYN_FUNC Complex< Real > pow(const Complex< Real > &, const Real &)
Definition Complex.inl:370
DYN_FUNC Complex< Real > tan(const Complex< Real > &)
Definition Complex.inl:581
DYN_FUNC Complex< Real > cos(const Complex< Real > &)
Definition Complex.inl:573
DYN_FUNC Complex< Real > acos(const Complex< Real > &)
Definition Complex.inl:519
DYN_FUNC Complex< Real > acosh(const Complex< Real > &)
Definition Complex.inl:427
DYN_FUNC Complex< Real > asinh(const Complex< Real > &)
Definition Complex.inl:384
DYN_FUNC Complex< Real > exp(const Complex< Real > &)
Definition Complex.inl:338
DYN_FUNC Complex< Real > sqrt(const Complex< Real > &)
Definition Complex.inl:321
DYN_FUNC Complex< Real > polar(const Real &__rho, const Real &__theta=Real(0))
Definition Complex.inl:279
DYN_FUNC Complex< Real > log10(const Complex< Real > &)
Definition Complex.inl:313
DYN_FUNC Complex< Real > sinh(const Complex< Real > &)
Definition Complex.inl:260
DYN_FUNC Complex< Real > asin(const Complex< Real > &)
Definition Complex.inl:510
DYN_FUNC Complex< Real > atan(const Complex< Real > &)
Definition Complex.inl:555