PCL
pcl::Complex< T > Class Template Reference

Generic complex number. More...

#include <Complex.h>

Public Types

typedef T component
 

Public Member Functions

 Complex ()
 
 Complex (T r, T i=0)
 
template<typename T1 >
 Complex (const Complex< T1 > &c)
 
constexpr T Arg () const
 
Complex< T > Conj () const
 
constexpr T Imag () const
 
T & Imag ()
 
constexpr bool IsReal () const
 
Mag () const
 
constexpr T Norm () const
 
template<typename T1 >
Complex< T > & operator*= (const Complex< T1 > &c)
 
template<typename T1 >
Complex< T > & operator*= (T1 x)
 
Complex< T > operator+ () const
 
template<typename T1 >
Complex< T > & operator+= (const Complex< T1 > &c)
 
template<typename T1 >
Complex< T > & operator+= (T1 x)
 
Complex< T > operator- () const
 
template<typename T1 >
Complex< T > & operator-= (const Complex< T1 > &c)
 
template<typename T1 >
Complex< T > & operator-= (T1 x)
 
template<typename T1 >
Complex< T > & operator/= (const Complex< T1 > &c)
 
template<typename T1 >
Complex< T > & operator/= (T1 x)
 
template<typename T1 >
Complex< T > & operator= (const Complex< T1 > &c)
 
template<typename T1 >
Complex< T > & operator= (T1 x)
 
Complex< T > operator~ () const
 
constexpr T Real () const
 
T & Real ()
 
void SetConj ()
 

Detailed Description

template<typename T>
class pcl::Complex< T >

Complex is a careful implementation of complex numbers, including efficient computations of complex arithmetic and transcendental functions.

When instantiated for the double and float types, the generated classes are binary-compatible with the C99 complex standard structure.

Definition at line 83 of file Complex.h.

Member Typedef Documentation

◆ component

template<typename T>
typedef T pcl::Complex< T >::component

Represents a component of a complex number: real or imaginary part.

Definition at line 90 of file Complex.h.

Constructor & Destructor Documentation

◆ Complex() [1/3]

template<typename T>
pcl::Complex< T >::Complex ( )
inline

Constructs an uninitialized complex number. The real and imaginary components will have unpredictable values.

Definition at line 96 of file Complex.h.

◆ Complex() [2/3]

template<typename T>
pcl::Complex< T >::Complex ( r,
i = 0 
)
inline

Constructs a complex number with the specified real and imaginary parts.

Definition at line 103 of file Complex.h.

◆ Complex() [3/3]

template<typename T>
template<typename T1 >
pcl::Complex< T >::Complex ( const Complex< T1 > &  c)
inline

Copy constructor.

Definition at line 113 of file Complex.h.

Member Function Documentation

◆ Arg()

template<typename T>
constexpr T pcl::Complex< T >::Arg ( ) const
inline

Complex argument. Returns the arc whose tangent is Imag()/Real(). When both real and imaginary components are zero, this function returns zero.

Definition at line 375 of file Complex.h.

Referenced by pcl::Ln().

◆ Conj()

template<typename T>
Complex<T> pcl::Complex< T >::Conj ( ) const
inline

Complex conjugate. This function is equivalent to: Complex<T>( Real(), -Imag() )

Definition at line 315 of file Complex.h.

◆ Imag() [1/2]

template<typename T>
constexpr T pcl::Complex< T >::Imag ( ) const
inline

Returns a copy of the imaginary component of this complex number.

Definition at line 138 of file Complex.h.

Referenced by pcl::Cos(), pcl::Cosh(), pcl::IsoString::IsoString(), pcl::operator*(), pcl::operator+(), pcl::operator-(), pcl::operator/(), pcl::operator==(), pcl::Pow(), pcl::Round(), pcl::Sin(), pcl::Sinh(), and pcl::Sqrt().

◆ Imag() [2/2]

template<typename T>
T& pcl::Complex< T >::Imag ( )
inline

Returns a reference to the imaginary component of this complex number.

Definition at line 146 of file Complex.h.

◆ IsReal()

template<typename T>
constexpr bool pcl::Complex< T >::IsReal ( ) const
inline

Returns true iff the imaginary part of this complex number is zero.

Definition at line 154 of file Complex.h.

◆ Mag()

template<typename T>
T pcl::Complex< T >::Mag ( ) const
inline

Complex magnitude (modulus).

Accurate results are guaranteed even for large ratios between the real and complex components.

Definition at line 343 of file Complex.h.

Referenced by pcl::Ln(), and pcl::operator<().

◆ Norm()

template<typename T>
constexpr T pcl::Complex< T >::Norm ( ) const
inline

Complex norm. This function is equivalent to: Real()*Real() + Imag()*Imag().

Definition at line 365 of file Complex.h.

◆ operator*=() [1/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator*= ( const Complex< T1 > &  c)
inline

Assignment/multiply operator. Multiplies this complex number by the specified complex c. Returns a reference to this complex number.

Definition at line 196 of file Complex.h.

◆ operator*=() [2/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator*= ( T1  x)
inline

Multiplies this complex number by a real number. The real component is multiplied by the specified scalar x. Returns a reference to this complex number.

Definition at line 273 of file Complex.h.

◆ operator+()

template<typename T>
Complex<T> pcl::Complex< T >::operator+ ( ) const
inline

Unary plus operator. Returns a copy of this complex number.

Definition at line 295 of file Complex.h.

◆ operator+=() [1/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator+= ( const Complex< T1 > &  c)
inline

Assignment/sum operator. Adds the specified complex number c to this. Returns a reference to this complex number.

Definition at line 174 of file Complex.h.

◆ operator+=() [2/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator+= ( T1  x)
inline

Adds a real number to this complex number. The specified scalar x is added to the real component. Returns a reference to this complex number.

Definition at line 249 of file Complex.h.

◆ operator-()

template<typename T>
Complex<T> pcl::Complex< T >::operator- ( ) const
inline

Unary minus operator. Returns a complex number symmetric to this.

This function is equivalent to: Complex<T>( -Real(), -Imag() )

Definition at line 306 of file Complex.h.

◆ operator-=() [1/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator-= ( const Complex< T1 > &  c)
inline

Assignment/subtract operator. Subtracts the specified complex number c from this. Returns a reference to this complex number.

Definition at line 185 of file Complex.h.

◆ operator-=() [2/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator-= ( T1  x)
inline

Subtracts a real number from this complex number. The specified scalar x is subtracted from the real component. Returns a reference to this complex number.

Definition at line 261 of file Complex.h.

◆ operator/=() [1/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator/= ( const Complex< T1 > &  c)
inline

Assignment/divide operator. Divides this complex number by the specified complex c. Returns a reference to this complex number.

Definition at line 209 of file Complex.h.

◆ operator/=() [2/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator/= ( T1  x)
inline

Divides this complex number by a real number. The real component is divided by the specified scalar x. Returns a reference to this complex number.

Definition at line 285 of file Complex.h.

◆ operator=() [1/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator= ( const Complex< T1 > &  c)
inline

Assignment operator. Returns a reference to this complex number.

Definition at line 163 of file Complex.h.

◆ operator=() [2/2]

template<typename T>
template<typename T1 >
Complex<T>& pcl::Complex< T >::operator= ( T1  x)
inline

Assigns a real number to this complex number. The specified scalar x is assigned to the real component, and the imaginary component is set to zero. Returns a reference to this complex number.

Definition at line 238 of file Complex.h.

◆ operator~()

template<typename T>
Complex<T> pcl::Complex< T >::operator~ ( ) const
inline

Complex conjugate. This operator is a synonym for Conj().

Definition at line 323 of file Complex.h.

◆ Real() [1/2]

template<typename T>
constexpr T pcl::Complex< T >::Real ( ) const
inline

Returns a copy of the real component of this complex number.

Definition at line 122 of file Complex.h.

Referenced by pcl::Cos(), pcl::Cosh(), pcl::IsoString::IsoString(), pcl::operator*(), pcl::operator+(), pcl::operator-(), pcl::operator/(), pcl::operator==(), pcl::Pow(), pcl::Round(), pcl::Sin(), pcl::Sinh(), and pcl::Sqrt().

◆ Real() [2/2]

template<typename T>
T& pcl::Complex< T >::Real ( )
inline

Returns a reference to the real component of this complex number.

Definition at line 130 of file Complex.h.

◆ SetConj()

template<typename T>
void pcl::Complex< T >::SetConj ( )
inline

Assigns to this complex number its complex conjugate. This function changes the sign of the imaginary part of this complex number.

Definition at line 332 of file Complex.h.


The documentation for this class was generated from the following file: