OpenWareLaboratory
ComplexFloat Struct Reference

A structure defining a floating point complex number as two members of type float. More...

Public Member Functions

constexpr ComplexFloat ()
 
constexpr ComplexFloat (float re, float im)
 
constexpr ComplexFloat (float x)
 
ComplexFloat getComplexConjugate () const
 Returns complex conjugate - a copy of current number with imaginary part inverted. More...
 
ComplexFloat getDotProduct (ComplexFloat other) const
 Returns dot product with another complex float value. More...
 
float getMagnitude () const
 Get the magnitude of the complex number. More...
 
float getMagnitudeSquared () const
 Get the squared magnitude of the complex number. More...
 
float getPhase () const
 Get the phase of the complex number. More...
 
bool operator!= (const ComplexFloat &other) const
 
ComplexFloatoperator*= (const ComplexFloat &other)
 
ComplexFloatoperator*= (float other)
 
ComplexFloatoperator+= (const ComplexFloat &other)
 
ComplexFloatoperator+= (float other)
 
ComplexFloatoperator-= (const ComplexFloat &other)
 
ComplexFloatoperator-= (float other)
 
ComplexFloatoperator/= (float other)
 
bool operator< (const ComplexFloat &other) const
 
bool operator<= (const ComplexFloat &other) const
 
bool operator== (const ComplexFloat &other) const
 
bool operator> (const ComplexFloat &other) const
 
bool operator>= (const ComplexFloat &other) const
 
void setMagnitude (float magnitude)
 Set the magnitude of the complex number. More...
 
void setPhase (float phase)
 Set the phase of the complex number. More...
 
void setPolar (float magnitude, float phase)
 Set magnitude and phase of the complex number. More...
 

Data Fields

float im
 The imaginary part of the complex number. More...
 
float re
 The real part of the complex number. More...
 

Friends

const ComplexFloat operator* (const ComplexFloat &lhs, const ComplexFloat &rhs)
 
const ComplexFloat operator* (const ComplexFloat &lhs, float rhs)
 
const ComplexFloat operator+ (const ComplexFloat &lhs, const ComplexFloat &rhs)
 
const ComplexFloat operator+ (const ComplexFloat &lhs, float rhs)
 
const ComplexFloat operator- (const ComplexFloat &lhs, const ComplexFloat &rhs)
 
const ComplexFloat operator- (const ComplexFloat &lhs, float rhs)
 
const ComplexFloat operator/ (const ComplexFloat &lhs, float rhs)
 

Detailed Description

A structure defining a floating point complex number as two members of type float.

Definition at line 10 of file ComplexFloatArray.h.

Constructor & Destructor Documentation

◆ ComplexFloat() [1/3]

constexpr ComplexFloat::ComplexFloat ( )
inlineconstexpr

Definition at line 11 of file ComplexFloatArray.h.

◆ ComplexFloat() [2/3]

constexpr ComplexFloat::ComplexFloat ( float  x)
inlineconstexpr

Definition at line 12 of file ComplexFloatArray.h.

◆ ComplexFloat() [3/3]

constexpr ComplexFloat::ComplexFloat ( float  re,
float  im 
)
inlineconstexpr

Definition at line 13 of file ComplexFloatArray.h.

Member Function Documentation

◆ getComplexConjugate()

ComplexFloat ComplexFloat::getComplexConjugate ( ) const
inline

Returns complex conjugate - a copy of current number with imaginary part inverted.

Definition at line 86 of file ComplexFloatArray.h.

References im, and re.

◆ getDotProduct()

ComplexFloat ComplexFloat::getDotProduct ( ComplexFloat  other) const
inline

Returns dot product with another complex float value.

Definition at line 93 of file ComplexFloatArray.h.

References im, and re.

◆ getMagnitude()

float ComplexFloat::getMagnitude ( ) const
inline

Get the magnitude of the complex number.

Computes and returns the magnitude of the complex number.

Returns
The magnitude of the complex number.

Definition at line 30 of file ComplexFloatArray.h.

References im, and re.

Referenced by ComplexFloatArray::getPolar(), and setPhase().

◆ getMagnitudeSquared()

float ComplexFloat::getMagnitudeSquared ( ) const
inline

Get the squared magnitude of the complex number.

Computes and returns the squaredmagnitude of the complex number, which is cheaper to compute than the magnitude itself.

Returns
The squared magnitude of the complex number.

Definition at line 40 of file ComplexFloatArray.h.

References im, and re.

Referenced by operator<(), operator<=(), operator>(), and operator>=().

◆ getPhase()

float ComplexFloat::getPhase ( ) const
inline

Get the phase of the complex number.

Computes and returns the phase of the complex number.

Returns
The phase of the complex number.

Definition at line 49 of file ComplexFloatArray.h.

References im, and re.

Referenced by ComplexFloatArray::getPolar(), and setMagnitude().

◆ operator!=()

bool ComplexFloat::operator!= ( const ComplexFloat other) const
inline

Definition at line 117 of file ComplexFloatArray.h.

References im, and re.

◆ operator*=() [1/2]

ComplexFloat& ComplexFloat::operator*= ( const ComplexFloat other)
inline

Definition at line 185 of file ComplexFloatArray.h.

References im, and re.

◆ operator*=() [2/2]

ComplexFloat& ComplexFloat::operator*= ( float  other)
inline

Definition at line 179 of file ComplexFloatArray.h.

References im, and re.

◆ operator+=() [1/2]

ComplexFloat& ComplexFloat::operator+= ( const ComplexFloat other)
inline

Definition at line 138 of file ComplexFloatArray.h.

References im, and re.

◆ operator+=() [2/2]

ComplexFloat& ComplexFloat::operator+= ( float  other)
inline

Definition at line 133 of file ComplexFloatArray.h.

References re.

◆ operator-=() [1/2]

ComplexFloat& ComplexFloat::operator-= ( const ComplexFloat other)
inline

Definition at line 161 of file ComplexFloatArray.h.

References im, and re.

◆ operator-=() [2/2]

ComplexFloat& ComplexFloat::operator-= ( float  other)
inline

Definition at line 156 of file ComplexFloatArray.h.

References re.

◆ operator/=()

ComplexFloat& ComplexFloat::operator/= ( float  other)
inline

Definition at line 197 of file ComplexFloatArray.h.

References im, and re.

◆ operator<()

bool ComplexFloat::operator< ( const ComplexFloat other) const
inline

Definition at line 97 of file ComplexFloatArray.h.

References getMagnitudeSquared().

◆ operator<=()

bool ComplexFloat::operator<= ( const ComplexFloat other) const
inline

Definition at line 105 of file ComplexFloatArray.h.

References getMagnitudeSquared().

◆ operator==()

bool ComplexFloat::operator== ( const ComplexFloat other) const
inline

Definition at line 113 of file ComplexFloatArray.h.

References im, and re.

◆ operator>()

bool ComplexFloat::operator> ( const ComplexFloat other) const
inline

Definition at line 101 of file ComplexFloatArray.h.

References getMagnitudeSquared().

◆ operator>=()

bool ComplexFloat::operator>= ( const ComplexFloat other) const
inline

Definition at line 109 of file ComplexFloatArray.h.

References getMagnitudeSquared().

◆ setMagnitude()

void ComplexFloat::setMagnitude ( float  magnitude)
inline

Set the magnitude of the complex number.

Set the magnitude of the complex number, keeping the phase unaltered.

Parameters
magnitudeThe new magnitude of the complex number

Definition at line 68 of file ComplexFloatArray.h.

References getPhase(), and setPolar().

◆ setPhase()

void ComplexFloat::setPhase ( float  phase)
inline

Set the phase of the complex number.

Set the phase of the complex number, keeping the magnitude unaltered.

Parameters
phaseThe new phase of the complex number

Definition at line 58 of file ComplexFloatArray.h.

References getMagnitude(), and setPolar().

Referenced by ComplexFloatArray::setPhase().

◆ setPolar()

void ComplexFloat::setPolar ( float  magnitude,
float  phase 
)
inline

Set magnitude and phase of the complex number.

Parameters
magnitudeThe new magnitude of the complex number
phaseThe new phase of the complex number

Definition at line 78 of file ComplexFloatArray.h.

References im, and re.

Referenced by setMagnitude(), ComplexFloatArray::setMagnitude(), setPhase(), ComplexFloatArray::setPhase(), and ComplexFloatArray::setPolar().

Friends And Related Function Documentation

◆ operator* [1/2]

const ComplexFloat operator* ( const ComplexFloat lhs,
const ComplexFloat rhs 
)
friend

Definition at line 167 of file ComplexFloatArray.h.

◆ operator* [2/2]

const ComplexFloat operator* ( const ComplexFloat lhs,
float  rhs 
)
friend

Definition at line 173 of file ComplexFloatArray.h.

◆ operator+ [1/2]

const ComplexFloat operator+ ( const ComplexFloat lhs,
const ComplexFloat rhs 
)
friend

Definition at line 121 of file ComplexFloatArray.h.

◆ operator+ [2/2]

const ComplexFloat operator+ ( const ComplexFloat lhs,
float  rhs 
)
friend

Definition at line 127 of file ComplexFloatArray.h.

◆ operator- [1/2]

const ComplexFloat operator- ( const ComplexFloat lhs,
const ComplexFloat rhs 
)
friend

Definition at line 144 of file ComplexFloatArray.h.

◆ operator- [2/2]

const ComplexFloat operator- ( const ComplexFloat lhs,
float  rhs 
)
friend

Definition at line 150 of file ComplexFloatArray.h.

◆ operator/

const ComplexFloat operator/ ( const ComplexFloat lhs,
float  rhs 
)
friend

Definition at line 191 of file ComplexFloatArray.h.

Field Documentation

◆ im

◆ re


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