MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / Complex

Class Complex

libraries/Complex/complex.h:18–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17
18class Complex: public Printable
19{
20public:
21 Complex(const float r = 0, const float i = 0) : re(r), im(i) {};
22 Complex(const Complex &c) : re(c.re), im(c.im) {};
23
24
25 void set(const float r, const float i ) { re = r; im = i; };
26 void setReal(const float r) { re = r; };
27 void setImag(const float i ) { im = i; };
28 float real() const { return re; };
29 float imag() const { return im; };
30
31
32 size_t printTo(Print& p) const;
33
34
35 void polar(const float modulus, const float phase);
36 float phase() const { return atan2(im, re); };
37 float modulus() const { return hypot(re, im); };
38 // conjugate is the number mirrored in x-axis
39 Complex conjugate() const { return Complex(re, -im); };
40 Complex reciprocal() const;
41
42
43 bool operator == (const Complex&) const;
44 bool operator != (const Complex&) const;
45
46
47 Complex operator - () const; // negation
48
49
50 Complex operator + (const Complex&) const;
51 Complex operator - (const Complex&) const;
52 Complex operator * (const Complex&) const;
53 Complex operator / (const Complex&) const;
54
55 Complex& operator += (const Complex&);
56 Complex& operator -= (const Complex&);
57 Complex& operator *= (const Complex&);
58 Complex& operator /= (const Complex&);
59
60
61 Complex c_sqrt() const;
62 Complex c_sqr() const;
63 Complex c_exp() const;
64 Complex c_log() const;
65 Complex c_log10() const;
66 Complex c_pow(const Complex &) const;
67 Complex c_logn(const Complex &) const;
68
69
70 Complex c_sin() const;
71 Complex c_cos() const;
72 Complex c_tan() const;
73 Complex c_asin() const;
74 Complex c_acos() const;
75 Complex c_atan() const;

Callers 15

conjugateMethod · 0.85
reciprocalMethod · 0.85
operator -Method · 0.85
operator +Method · 0.85
operator *Method · 0.85
operator /Method · 0.85
c_sqrMethod · 0.85
c_sqrtMethod · 0.85
c_expMethod · 0.85
c_logMethod · 0.85
c_sinMethod · 0.85
c_cosMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected