52 #ifndef __PCL_Complex_h 53 #define __PCL_Complex_h 58 #include <pcl/Diagnostics.h> 112 template <
typename T1>
115 real = T( c.
Real() );
116 imag = T( c.
Imag() );
122 constexpr T Real()
const 138 constexpr T Imag()
const 162 template <
typename T1>
165 real = T( c.
Real() ), imag = T( c.
Imag() );
173 template <
typename T1>
184 template <
typename T1>
195 template <
typename T1>
198 T t = T( real*c.
Real() - imag*c.
Imag() );
199 imag = T( imag*c.
Real() + real*c.
Imag() );
208 template <
typename T1>
214 PCL_PRECONDITION( c.
Real() != 0 )
217 t = T( (real + r*imag)/d );
218 imag = (imag - r*real)/d;
222 PCL_PRECONDITION( c.
Imag() != 0 )
225 t = T( (real*r + imag)/d );
226 imag = (imag*r - real)/d;
237 template <
typename T1>
248 template <
typename T1>
260 template <
typename T1>
272 template <
typename T1>
275 real *= x, imag *= x;
284 template <
typename T1>
287 PCL_PRECONDITION( x != 0 )
288 real /= x, imag /= x;
367 return real*real + imag*imag;
375 constexpr T Arg()
const 380 return (real != 0 || imag != 0) ?
pcl::ArcTan( imag, real ) : 0;
398 template <
typename T>
399 struct PCL_AssertComplexSize
401 static_assert(
sizeof(
Complex<T> ) == 2*
sizeof( T ),
"Invalid sizeof( Complex<> )" );
419 template <
typename T>
inline 431 template <
typename T>
inline 442 template <
typename T>
inline 454 template <
typename T1,
class T2>
inline 469 template <
typename T1,
class T2>
inline 483 template <
typename T1,
class T2>
inline 494 template <
typename T1,
class T2>
inline 511 template <
typename T1,
class T2>
inline 527 template <
typename T1,
class T2>
inline 538 template <
typename T1,
class T2>
inline 555 template <
typename T1,
class T2>
inline 571 template <
typename T1,
class T2>
inline 582 template <
typename T1,
class T2>
inline 589 PCL_PRECONDITION( c2.
Real() != 0 )
597 PCL_PRECONDITION( c2.
Imag() != 0 )
616 template <
typename T1,
class T2>
inline 619 PCL_PRECONDITION( x != 0 )
633 template <
typename T1,
class T2>
inline 641 PCL_PRECONDITION( c.
Real() != 0 )
644 c3.
Real() = T2( x/d );
645 c3.
Imag() = T2( -((r*x)/d) );
649 PCL_PRECONDITION( c.
Imag() != 0 )
652 c3.
Real() = T2( (r*x)/d );
653 c3.
Imag() = T2( -(x/d) );
664 template <
typename T>
inline 667 if ( c.
Real() == 0 && c.
Imag() == 0 )
675 PCL_PRECONDITION( r != 0 )
681 PCL_PRECONDITION( i != 0 )
693 c1.
Imag() = (c.
Imag() >= 0) ? m : -m;
704 template <
typename T>
inline 715 template <
typename T>
inline 725 template <
typename T>
inline 737 template <
typename T1,
class T2>
inline 750 template <
typename T1,
class T2>
inline 764 template <
typename T>
inline 767 if ( c2.
Imag() == 0 )
769 else if ( c1.
Imag() == 0 )
785 template <
typename T>
inline 796 template <
typename T>
inline 807 template <
typename T>
inline 817 template <
typename T>
inline 828 template <
typename T>
inline 839 template <
typename T>
inline 861 template <
typename T1,
class T2>
inline 871 template <
typename T1,
class T2>
inline 874 return c.
Real() == x && c.
Imag() == T1( 0 );
881 template <
typename T1,
class T2>
inline 891 template <
typename T1,
class T2>
inline 894 return c1.
Mag() < c2.Mag();
901 template <
typename T1,
class T2>
inline 902 bool operator <( const Complex<T1>& c, T2 x )
911 template <
typename T1,
class T2>
inline 912 bool operator <( T1 x, const Complex<T2>& c )
928 template <
typename T>
inline 940 template <
typename T>
inline 943 PCL_PRECONDITION( n >= 0 )
973 template <
typename T>
inline 976 const T tiny = T( 1.0e-20 );
977 for ( ; i < j; ++i, ++a, ++b )
980 *i = n/
Max( tiny,
Abs( n ) );
1004 template <
typename T>
inline 1007 const T tiny = T( 1.0e-20 );
1008 for ( ; i < j; ++i, ++a, ++b )
1009 *i = (*b * ~*a)/
Max( tiny,
Abs( *a ) *
Abs( *b ) );
1031 #ifndef __PCL_NO_COMPLEX_INSTANTIATE 1090 #endif // __PCL_NO_COMPLEX_INSTANTIATE 1096 #endif // __PCL_Complex_h Complex< T > Log(const Complex< T > &c)
static constexpr T log10e()
void CrossPowerSpectrumMatrix(Complex< T > *i, const Complex< T > *j, const Complex< T > *a, const Complex< T > *b)
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2)
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2)
A complex number whose components are 32-bit floating point real numbers.
double Norm(const T *i, const T *j, double p)
Complex< T > Polar(T r, T stheta, T ctheta)
Complex< T > Sqrt(const Complex< T > &c)
Complex< T > Round(const Complex< T > &c)
Complex(const Complex< T1 > &c)
A complex number whose components are 64-bit floating point real numbers.
T Abs(const Complex< T > &c)
Complex< T > Conj() const
constexpr const T & Max(const T &a, const T &b)
Complex< T > Sinh(const Complex< T > &c)
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2)
A complex number whose components are 64-bit floating point real numbers.
Complex< T > Cosh(const Complex< T > &c)
constexpr bool IsReal() const
Complex< T > Ln(const Complex< T > &c)
void PhaseCorrelationMatrix(Complex< T > *i, const Complex< T > *j, const Complex< T > *a, const Complex< T > *b)
A complex number whose components are 64-bit floating point real numbers.
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2)
Complex< T1 > operator/(const Complex< T1 > &c1, const Complex< T2 > &c2)
Complex< T > Sin(const Complex< T > &c)
Complex< T > Cos(const Complex< T > &c)
Complex< T > Exp(const Complex< T > &c)
A complex number whose components are 32-bit floating point real numbers.
Complex< T > Tan(const Complex< T > &c)
Complex< T1 > Pow(const Complex< T1 > &c, T2 x)
Complex< T > Tanh(const Complex< T > &c)