itpp::CFixed< w, e, o, q > Class Template Reference
[Fixed-point Module]

Templated complex fixed-point data type. More...

#include <cfixed.h>

List of all members.

Public Member Functions

 CFixed (double r=0.0, double i=0.0, int s=0, Stat *ptr=0)
 Default constructor.
 CFixed (std::complex< double > x, double, int s=0, Stat *ptr=0)
 Constructor.
 CFixed (Stat *ptr)
 Constructor.
 CFixed (const Fix &r, const Fix &i=0.0, Stat *ptr=0)
 Constructor.
 CFixed (const CFix &x, double, Stat *ptr=0)
 Constructor.
virtual ~CFixed ()
 Destructor.
CFixedoperator= (const CFix &x)
 Assignment from CFix.
CFixedoperator= (const Fix &x)
 Assignment from Fix.
CFixedoperator= (const std::complex< double > &x)
 Assignment from complex<double>. Fractional part is truncated.
CFixedoperator= (int x)
 Assignment from int.
CFixoperator+= (const CFix &x)
 Addition of CFix.
CFixoperator+= (const Fix &x)
 Addition of Fix.
CFixoperator+= (const int x)
 Addition of int.
CFixoperator-= (const CFix &x)
 Subtraction of CFix.
CFixoperator-= (const Fix &x)
 Subtraction of Fix.
CFixoperator-= (const int x)
 Subtraction of int.
CFixoperator*= (const CFix &x)
 Multiplication with CFix. Temporary variables use the maximum word length (64 bits).
CFixoperator*= (const Fix &x)
 Multiplication with Fix. Temporary variables use the maximum word length (64 bits).
CFixoperator*= (const int x)
 Multiplication with int. Temporary variables use the maximum word length (64 bits).
CFixoperator/= (const CFix &x)
 Division with CFix using quantization mode TRN. Temporary variables use the maximum word length (64 bits).
CFixoperator/= (const Fix &x)
 Division with Fix using quantization mode TRN. Temporary variables use the maximum word length (64 bits).
CFixoperator/= (const int x)
 Division with int using quantization mode TRN. Temporary variables use the maximum word length (64 bits).
CFix operator- () const
 Unary negative of CFix.
CFixoperator<<= (const int n)
 Left shift n bits.
CFixoperator>>= (const int n)
 Right shift n bits using quantization mode qmode (constructor argument).
void set (double real, double imag, int n)
 Set to (real + i*imag) * pow2(n) using quantization mode qmode (constructor argument).
void set (double real, double imag, int n, q_mode q)
 Set to (real + i*imag) * pow2(n) using quantization mode q (function argument).
void set (const std::complex< double > &x, int n)
 Set to x * pow2(n) using quantization mode qmode (constructor argument).
void set (const std::complex< double > &x, int n, q_mode q)
 Set to x * pow2(n) using quantization mode q (function argument).
void set_re (fixrep x)
 Set data representation for real part (mainly for internal use since it reveals the representation type).
void set_im (fixrep x)
 Set data representation for imaginary part (mainly for internal use since it reveals the representation type).
void lshift (int n)
 Left shift n bits.
void rshift (int n)
 Right shift n bits using quantization mode qmode (constructor argument).
void rshift (int n, q_mode q)
 Right shift n bits using quantization mode q (function argument).
virtual void print () const
 Print restrictions.
fixrep get_re () const
 Get data representation for real part (mainly for internal use since it reveals the representation type).
fixrep get_im () const
 Get data representation for imaginary part (mainly for internal use since it reveals the representation type).
std::complex< double > unfix () const
 Conversion to std::complex<double>.
 operator std::complex< double > () const
 Conversion to std::complex<double>.
void set_shift (int s)
 Set shift (without shifting).
int get_shift () const
 Get shift.
int get_wordlen () const
 Get word length.
e_mode get_e_mode () const
 Get sign encoding mode.
o_mode get_o_mode () const
 Get overflow mode.
q_mode get_q_mode () const
 Get quantization mode.
output_mode get_output_mode () const
 Get output mode.
fixrep get_max () const
 Get maximum value of data representation.
fixrep get_min () const
 Get minimum value of data representation.

Static Public Member Functions

static void set_output_mode (output_mode o)
 Set output mode to OUTPUT_FIX, OUTPUT_FIX_SHIFT, OUTPUT_FLOAT or OUTPUT_FLOAT_SHIFT. Static member function.
static void set_output_mode (std::string o)
 Set output mode to "OUTPUT_FIX", "OUTPUT_FIX_SHIFT", "OUTPUT_FLOAT" or "OUTPUT_FLOAT_SHIFT". Static member function.

Protected Member Functions

void init ()
 Calculate help variables min, max and n_unused_bits.
fixrep apply_o_mode (fixrep x) const
 Handle overflows using overflow mode omode and make call to statistics object (if any).
fixrep scale_and_apply_modes (double x) const
 Convert from double to fixrep using shift and quantization mode qmode, then call limit().
fixrep scale_and_apply_modes (double x, q_mode q) const
 Convert from double to fixrep using shift and quantization mode q, then call limit().
fixrep rshift_and_apply_q_mode (fixrep x, int n) const
 Right shift n bits using quantization mode qmode and make call to statistics object (if any).
fixrep rshift_and_apply_q_mode (fixrep x, int n, q_mode q) const
 Right shift n bits using quantization mode q and make call to statistics object (if any).

Protected Attributes

fixrep re
 Real data part.
fixrep im
 Imaginary data part.
int shift
 Accumulated bitshift (positive means left-shifted, negative means right-shifted).
int wordlen
 Word length.
e_mode emode
 Sign encoding mode.
o_mode omode
 Overflow mode.
q_mode qmode
 Quantization mode.
Statstat_ptr
 Pointer to statistics object.
fixrep min
 Minimum allowed value (help variable to speed up calculations).
fixrep max
 Maximum allowed value (help variable to speed up calculations).
int n_unused_bits
 Number of unused (MSB) bits (help variable to speed up calculations).

Friends

int assert_shifts (const CFix &x, const CFix &y)
 Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument).
int assert_shifts (const CFix &x, const Fix &y)
 Check that x.shift==y.shift OR x==0 OR y==0 and return the shift (for the non-zero argument).
int assert_shifts (const CFix &x, int y)
 Check that x.shift==0 OR x==0 OR y==0 and return x.shift.


Detailed Description

template<int w, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN>
class itpp::CFixed< w, e, o, q >

Templated complex fixed-point data type.

See the Detailed Description in the Fixed-point Module module.


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

Generated on Tue Jun 2 10:02:19 2009 for mixpp by  doxygen 1.5.8