|
Complex | operator* (const Complex a, const Complex b) |
|
Complex | operator* (const Complex a, const float b) |
|
Complex | operator* (const float b, const Complex a) |
|
Complex | operator/ (const Complex a, const float b) |
|
Complex | operator/ (const float b, const Complex a) |
|
Complex | operator/ (const Complex a, const Complex b) |
|
Complex | operator+ (const Complex a, const Complex b) |
|
Complex | operator+ (const Complex a, const float b) |
|
Complex | operator+ (const float b, const Complex a) |
|
Complex | operator- (const Complex a, const Complex b) |
|
Complex | operator- (const Complex a, const float b) |
|
Complex | operator- (const float b, const Complex a) |
|
float | norm2 (const Complex &a) |
|
float | realpart (const Complex &a) |
|
float | imagpart (const Complex &a) |
|
std::ostream & | operator<< (std::ostream &os, const Complex &a) |
|
std::istream & | operator>> (std::istream &os, Complex &a) |
|
Complex | id (const Complex &x) |
|
Complex | pow (const Complex &, const float &) |
|
float | cos (const Complex &) |
|
float | sin (const Complex &) |
|
◆ Complex() [1/2]
fem::Complex::Complex |
( |
| ) |
|
|
inline |
◆ Complex() [2/2]
fem::Complex::Complex |
( |
float |
r, |
|
|
float |
i = 0.F |
|
) |
| |
|
inline |
◆ arg()
float fem::Complex::arg |
( |
| ) |
const |
|
inline |
148 {
149 if (modul2() > 1e-8)
150 if (im > 0)
151 return acos(re/sqrt(modul2()));
152 else
153 return 8*atan(1.) - acos(re/sqrt(modul2()));
154 else
155 return 0.;
156
157 }
◆ conjug()
100{return Complex(re,-im);}
◆ imag() [1/2]
float & fem::Complex::imag |
( |
| ) |
|
|
inline |
◆ imag() [2/2]
float fem::Complex::imag |
( |
| ) |
const |
|
inline |
◆ modul2()
float fem::Complex::modul2 |
( |
| ) |
const |
|
inline |
116{return ssqr(re)+ssqr(im);}
◆ operator*=() [1/2]
104{ re =a.re*re - a.im*im;im= a.re*im + a.im*re; return *this; }
◆ operator*=() [2/2]
Complex & fem::Complex::operator*= |
( |
const float |
a | ) |
|
|
inline |
111{ re *= a;im *= a; return *this; }
◆ operator+=() [1/2]
109{ re +=a.re; im += a.im; return *this; }
◆ operator+=() [2/2]
Complex & fem::Complex::operator+= |
( |
const float |
a | ) |
|
|
inline |
113{ re +=a; return *this; }
◆ operator-()
Complex & fem::Complex::operator- |
( |
| ) |
|
|
inline |
115{ re =-re; im =-im; return *this; }
◆ operator-=() [1/2]
110{ re -=a.re; im -= a.im; return *this; }
◆ operator-=() [2/2]
Complex & fem::Complex::operator-= |
( |
const float |
a | ) |
|
|
inline |
114{ re -=a; return *this; }
◆ operator/=() [1/2]
105 {
106 float xl=ssqr(a.re) + ssqr(a.im); re =(a.re*re+a.im*im)/xl; im =(a.re*im-a.im*re)/xl;
107 return *this;
108 }
◆ operator/=() [2/2]
Complex & fem::Complex::operator/= |
( |
const float |
a | ) |
|
|
inline |
112{ re /= a;im /= a; return *this; }
◆ operator=()
102{ re =a.re; im = a.im; return *this; }
◆ real() [1/2]
float & fem::Complex::real |
( |
| ) |
|
|
inline |
◆ real() [2/2]
float fem::Complex::real |
( |
| ) |
const |
|
inline |
◆ cos
166 {
167 return std::cos(c.real())*std::cosh(c.imag()) + std::sin(c.real())*std::sinh(c.imag());\
168 }
◆ id
100{
101 Complex c (0.F);
102 if ((x.im != 0.F)||(x.re != 0.F))
103 c.re = 1.F;
104 return c;
105}
◆ imagpart
float imagpart |
( |
const Complex & |
a | ) |
|
|
friend |
◆ norm2
134{ return a.modul2(); }
◆ operator* [1/3]
119{return Complex(a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re);}
◆ operator* [2/3]
120{ return Complex(a.re*b, a.im*b); }
◆ operator* [3/3]
121{ return Complex(a.re*b, a.im*b); }
◆ operator+ [1/3]
128{return Complex(a.re+b.re, a.im+b.im);}
◆ operator+ [2/3]
129{ return Complex(a.re+b, a.im); }
◆ operator+ [3/3]
130{ return Complex(a.re+b, a.im); }
◆ operator- [1/3]
131{return Complex(a.re-b.re, a.im-b.im);}
◆ operator- [2/3]
132{ return Complex(a.re-b, a.im); }
◆ operator- [3/3]
133{ return Complex(b-a.re, -a.im); }
◆ operator/ [1/3]
124 {
125 Complex c; float xl=ssqr(b.re) + ssqr(b.im); c.re =(a.re*b.re+a.im*b.im)/xl; c.im =(b.re*a.im-b.im*a.re)/xl;
126 return c;
127 }
◆ operator/ [2/3]
122{ return Complex(a.re/b, a.im/b); }
◆ operator/ [3/3]
123{ return Complex(b,0.F)/a; }
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const Complex & |
a |
|
) |
| |
|
friend |
74{
75 os << a.re << " " << a.im << " ";
76 return os;
77}
◆ operator>>
std::istream & operator>> |
( |
std::istream & |
os, |
|
|
Complex & |
a |
|
) |
| |
|
friend |
79{
80 os >> a.re >> a.im;
81 return os;
82}
◆ pow
160 {
161 Complex z(std::cos(f*c.arg()), std::sin(f*c.arg()));
162 return std::pow(std::sqrt(c.modul2()),f)*z;
163 }
◆ realpart
float realpart |
( |
const Complex & |
a | ) |
|
|
friend |
◆ sin
171 {
172 return std::sin(c.real())*std::cosh(c.imag()) - std::cos(c.real())*std::sinh(c.imag());
173 }
The documentation for this class was generated from the following file: