AudioDataLib
A C++ library of classes supporting a variety of audio-data tasks.
Loading...
Searching...
No Matches
AudioDataLib::ComplexNumber Class Reference

Instances of this class represent complex numbers in the complex plane. More...

#include <ComplexNumber.h>

Public Member Functions

 ComplexNumber ()
 
 ComplexNumber (const ComplexNumber &complexNumber)
 
 ComplexNumber (double realPart, double imagPart)
 
virtual ~ComplexNumber ()
 
void operator= (const ComplexNumber &complexNumber)
 
void operator+= (const ComplexNumber &complexNumber)
 
void operator-= (const ComplexNumber &complexNumber)
 
void operator*= (const ComplexNumber &complexNumber)
 
void operator/= (const ComplexNumber &complexNumber)
 
void operator+= (double realNumber)
 
void operator-= (double realNumber)
 
void operator*= (double realNumber)
 
void operator/= (double realNumber)
 
bool operator== (const ComplexNumber &complexNumber) const
 
bool operator!= (const ComplexNumber &complexNumber) const
 
 operator std::string () const
 
void Exp (const ComplexNumber &complexNumber)
 
void Exp (double realNumber)
 
void ExpI (double realNumber)
 
void Log (const ComplexNumber &complexNumber)
 
void Log (double realNumber)
 
void LogI (double realNumber)
 
ComplexNumber Conjugate () const
 
ComplexNumber Inverse () const
 
double SquareMagnitude () const
 
double Magnitude () const
 
double Angle () const
 

Public Attributes

double realPart
 The real component of this complex number.
 
double imagPart
 The imaginary component (or real multiple of the imaginary unit) of this complex number.
 

Detailed Description

Instances of this class represent complex numbers in the complex plane.

Interestingly, complex numbers show up in the analysis of wave-forms; particularly when an FFT (fast forier transform) is performed.

Constructor & Destructor Documentation

◆ ComplexNumber() [1/3]

ComplexNumber::ComplexNumber ( )

The default constructor always initializes this complex number to zero.

◆ ComplexNumber() [2/3]

ComplexNumber::ComplexNumber ( const ComplexNumber & complexNumber)

Initialize this complex number as a copy of the given complex number.

◆ ComplexNumber() [3/3]

ComplexNumber::ComplexNumber ( double realPart,
double imagPart )

Initialize this complex number with the given components.

◆ ~ComplexNumber()

ComplexNumber::~ComplexNumber ( )
virtual

Member Function Documentation

◆ Angle()

double ComplexNumber::Angle ( ) const

Calculate and return the angle (in [0,2pi)) made by this complex number when compared to the +X axis.

◆ Conjugate()

ComplexNumber ComplexNumber::Conjugate ( ) const

Calculate and return the conjugate of this complex number.

◆ Exp() [1/2]

void ComplexNumber::Exp ( const ComplexNumber & complexNumber)

Make this complex number the base of the natural logarithm raised to the power of the given complex number.

◆ Exp() [2/2]

void ComplexNumber::Exp ( double realNumber)

Make this complex number the base of the natural logarithm raised to the power of the given real number.

◆ ExpI()

void ComplexNumber::ExpI ( double realNumber)

Make this complex number the base of the natural logarithm raised to the power of the given imaginary number (or real multiple of the imaginary unit.)

◆ Inverse()

ComplexNumber ComplexNumber::Inverse ( ) const

Calculate and return the multiplicative inverse of this complex number.

◆ Log() [1/2]

void ComplexNumber::Log ( const ComplexNumber & complexNumber)

Make this complex number the natural logarithm of the given complex number.

◆ Log() [2/2]

void ComplexNumber::Log ( double realNumber)

Make this complex number the natural logarithm of the given real number.

◆ LogI()

void ComplexNumber::LogI ( double realNumber)

Make this complex number the natural logarithm of the given imaginary number (or real multiple of the imaginary unit.)

◆ Magnitude()

double ComplexNumber::Magnitude ( ) const

Calculate and return the magnitude of this complex number.

◆ operator std::string()

ComplexNumber::operator std::string ( ) const

◆ operator!=()

bool ComplexNumber::operator!= ( const ComplexNumber & complexNumber) const

◆ operator*=() [1/2]

void ComplexNumber::operator*= ( const ComplexNumber & complexNumber)

◆ operator*=() [2/2]

void ComplexNumber::operator*= ( double realNumber)

◆ operator+=() [1/2]

void ComplexNumber::operator+= ( const ComplexNumber & complexNumber)

◆ operator+=() [2/2]

void ComplexNumber::operator+= ( double realNumber)

◆ operator-=() [1/2]

void ComplexNumber::operator-= ( const ComplexNumber & complexNumber)

◆ operator-=() [2/2]

void ComplexNumber::operator-= ( double realNumber)

◆ operator/=() [1/2]

void ComplexNumber::operator/= ( const ComplexNumber & complexNumber)

◆ operator/=() [2/2]

void ComplexNumber::operator/= ( double realNumber)

◆ operator=()

void ComplexNumber::operator= ( const ComplexNumber & complexNumber)

◆ operator==()

bool ComplexNumber::operator== ( const ComplexNumber & complexNumber) const

◆ SquareMagnitude()

double ComplexNumber::SquareMagnitude ( ) const

Calculate and return the square magnitude of this complex number.

Member Data Documentation

◆ imagPart

double AudioDataLib::ComplexNumber::imagPart

The imaginary component (or real multiple of the imaginary unit) of this complex number.

◆ realPart

double AudioDataLib::ComplexNumber::realPart

The real component of this complex number.


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