OpenWareLaboratory
ComplexShort Struct Reference

A structure defining a fixed point complex number as two members of type int16_t. More...

Public Member Functions

int16_t getMagnitude ()
 Get the magnitude of the complex number. More...
 
int16_t getPhase ()
 Get the phase of the complex number. More...
 
bool operator!= (const ComplexShort &other) const
 
bool operator== (const ComplexShort &other) const
 
void setMagnitude (int16_t magnitude)
 Set the magnitude of the complex number. More...
 
void setPhase (int16_t phase)
 Set the phase of the complex number. More...
 
void setPolar (int16_t magnitude, int16_t phase)
 Set magnitude and phase of the complex number. More...
 

Data Fields

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

Detailed Description

A structure defining a fixed point complex number as two members of type int16_t.

Definition at line 9 of file ComplexShortArray.h.

Member Function Documentation

◆ getMagnitude()

int16_t ComplexShort::getMagnitude ( )

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 6 of file ComplexShortArray.cpp.

References FLOAT_TO_Q15, im, Q15_TO_FLOAT, and re.

Referenced by setPhase().

◆ getPhase()

int16_t ComplexShort::getPhase ( )

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 23 of file ComplexShortArray.cpp.

References FLOAT_TO_Q15, im, Q15_TO_FLOAT, and re.

Referenced by setMagnitude().

◆ operator!=()

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

Definition at line 65 of file ComplexShortArray.h.

References im, and re.

◆ operator==()

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

Definition at line 61 of file ComplexShortArray.h.

References im, and re.

◆ setMagnitude()

void ComplexShort::setMagnitude ( int16_t  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 49 of file ComplexShortArray.h.

References getPhase(), and setPolar().

◆ setPhase()

void ComplexShort::setPhase ( int16_t  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 39 of file ComplexShortArray.h.

References getMagnitude(), and setPolar().

◆ setPolar()

void ComplexShort::setPolar ( int16_t  magnitude,
int16_t  phase 
)

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 27 of file ComplexShortArray.cpp.

References FLOAT_TO_Q15, im, Q15_TO_FLOAT, and re.

Referenced by setMagnitude(), and setPhase().

Field Documentation

◆ im

int16_t ComplexShort::im

The imaginary part of the complex number.

Definition at line 18 of file ComplexShortArray.h.

Referenced by ComplexShortArray::add(), getMagnitude(), getPhase(), ComplexShortArray::im(), operator!=(), operator==(), ComplexShortArray::setAll(), and setPolar().

◆ re

int16_t ComplexShort::re

The real part of the complex number.

Definition at line 13 of file ComplexShortArray.h.

Referenced by ComplexShortArray::add(), getMagnitude(), getPhase(), operator!=(), operator==(), ComplexShortArray::re(), ComplexShortArray::setAll(), and setPolar().


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