PCL
pcl::Complex< T > Class Template Reference

Generic complex number. More...

#include <Complex.h>

Public Types

using component = T
 

Public Member Functions

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

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 >
using pcl::Complex< T >::component = T

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 ( )
default

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

◆ Complex() [2/3]

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

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

Definition at line 101 of file Complex.h.

◆ Complex() [3/3]

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

Nontrivial copy constructor.

Definition at line 111 of file Complex.h.

Member Function Documentation

◆ Arg()

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

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 384 of file Complex.h.

◆ Conj()

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

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

Definition at line 313 of file Complex.h.

◆ Imag() [1/2]

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

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

Definition at line 136 of file Complex.h.

Referenced by pcl::IsoString::IsoString(), and pcl::operator/().

◆ Imag() [2/2]

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

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

Definition at line 144 of file Complex.h.

◆ IsReal()

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

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

Definition at line 152 of file Complex.h.

◆ Mag()

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

Complex magnitude (modulus).

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

Definition at line 341 of file Complex.h.

◆ Norm()

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

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

Definition at line 374 of file Complex.h.

◆ operator double()

template<typename T >
pcl::Complex< T >::operator double ( ) const
inlineexplicitnoexcept

Explicit conversion operator to double.

Returns the complex magnitude or modulus of this complex number, so this operator is equivalent to Mag() const.

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)
inlinenoexcept

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

Definition at line 194 of file Complex.h.

◆ operator*=() [2/2]

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

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 271 of file Complex.h.

◆ operator+()

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

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

Definition at line 293 of file Complex.h.

◆ operator+=() [1/2]

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

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

Definition at line 172 of file Complex.h.

◆ operator+=() [2/2]

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

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 247 of file Complex.h.

◆ operator-()

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

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

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

Definition at line 304 of file Complex.h.

◆ operator-=() [1/2]

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

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

Definition at line 183 of file Complex.h.

◆ operator-=() [2/2]

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

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 259 of file Complex.h.

◆ operator/=() [1/2]

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

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

Definition at line 207 of file Complex.h.

◆ operator/=() [2/2]

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

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 283 of file Complex.h.

◆ operator=() [1/2]

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

Assignment operator. Returns a reference to this complex number.

Definition at line 161 of file Complex.h.

◆ operator=() [2/2]

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

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 236 of file Complex.h.

◆ operator~()

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

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

Definition at line 321 of file Complex.h.

◆ Real() [1/2]

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

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

Definition at line 120 of file Complex.h.

Referenced by pcl::IsoString::IsoString(), and pcl::operator/().

◆ Real() [2/2]

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

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

Definition at line 128 of file Complex.h.

◆ SetConj()

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

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

Definition at line 330 of file Complex.h.


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