|
|
|
|
@ -43,12 +43,12 @@ template<class T> class Complex {
|
|
|
|
|
* @brief Dot product |
|
|
|
|
* |
|
|
|
|
* @f[ |
|
|
|
|
* c_0 \cdot c_1 = c_0 \overline{c_1} = (a_0 a_1 + b_0 b_1) + i(a_1 b_0 - a_0 b_1) |
|
|
|
|
* c_0 \cdot c_1 = a_0 a_1 + b_0 b_1 |
|
|
|
|
* @f] |
|
|
|
|
* @see dot() const |
|
|
|
|
*/ |
|
|
|
|
inline static Complex<T> dot(const Complex<T>& a, const Complex<T>& b) { |
|
|
|
|
return a*b.conjugated(); |
|
|
|
|
inline static T dot(const Complex<T>& a, const Complex<T>& b) { |
|
|
|
|
return a._real*b._real + a._imaginary*b._imaginary; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -277,12 +277,12 @@ template<class T> class Complex {
|
|
|
|
|
* |
|
|
|
|
* Should be used instead of length() for comparing complex number length |
|
|
|
|
* with other values, because it doesn't compute the square root. @f[ |
|
|
|
|
* c \cdot c = c \overline c = a^2 + b^2 |
|
|
|
|
* c \cdot c = a^2 + b^2 |
|
|
|
|
* @f] |
|
|
|
|
* @see dot(const Complex&, const Complex&) |
|
|
|
|
*/ |
|
|
|
|
inline T dot() const { |
|
|
|
|
return _real*_real + _imaginary*_imaginary; |
|
|
|
|
return dot(*this, *this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -290,7 +290,7 @@ template<class T> class Complex {
|
|
|
|
|
* |
|
|
|
|
* See also dot() const which is faster for comparing length with other |
|
|
|
|
* values. @f[ |
|
|
|
|
* |c| = \sqrt{c \overline c} = \sqrt{a^2 + b^2} |
|
|
|
|
* |c| = \sqrt{c \cdot c} |
|
|
|
|
* @f] |
|
|
|
|
*/ |
|
|
|
|
inline T length() const { |
|
|
|
|
@ -318,7 +318,7 @@ template<class T> class Complex {
|
|
|
|
|
* |
|
|
|
|
* See invertedNormalized() which is faster for normalized |
|
|
|
|
* complex numbers. @f[ |
|
|
|
|
* c^{-1} = \frac{\overline c}{c \overline c} = \frac{\overline c}{a^2 + b^2} |
|
|
|
|
* c^{-1} = \frac{\overline c}{|c|^2} = \frac{\overline c}{c \cdot c} |
|
|
|
|
* @f] |
|
|
|
|
*/ |
|
|
|
|
inline Complex<T> inverted() const { |
|
|
|
|
|