Class factory for fixed-point data types Fix and CFix.
For an introduction to factories, see the Detailed Description for Factory. For more information on the fixed-point data types, see the Detailed Description in the Fixed-point Module module.
This example shows how to declare a Fix_Factory:
Fix_Factory(int w=MAX_WORDLEN, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN, Stat *ptr=0)
Constructor.
However, the user does not need to declare UFIX32
since it is one of the already declared factories in fix_factory.h (which is included by itbase.h):
...
Fix_Factory FIX64(64,
TC,
WRAP);
...
Fix_Factory UFIX64(64,
US,
WRAP);
...
Fix_Factory SFIX64(64,
TC,
SAT);
...
Fix_Factory SUFIX64(64,
US,
SAT);
const Fix_Factory FIX1(1, TC, WRAP)
Fix_Factories for signed Fix/CFix with wrap-around (FIX1, FIX2, ..., FIX64)
const Fix_Factory SFIX1(1, TC, SAT)
Fix_Factories for unsigned Fix/CFix with wrap-around (SFIX1, SFIX2, ..., SFIX64)
const Fix_Factory SUFIX1(1, US, SAT)
Fix_Factories for unsigned Fix/CFix with saturation (SUFIX1, SUFIX2, ..., SUFIX64)
const Fix_Factory UFIX1(1, US, WRAP)
Fix_Factories for unsigned Fix/CFix with wrap-around (UFIX1, UFIX2, ..., UFIX64)
This means that it is only necessary for the user to declare a Fix_Factory if it is desired to have some other overflow mode than WRAP
or SAT
, or some other quantization mode than TRN
, or a non-zero statistics object pointer.
- Note
- U stands for Unsigned but S stands for Saturated, NOT for Signed.
The Array/Vec/Mat constructors can take a Fix_Factory as an argument:
Vec<Fix> vf(10, UFIX32);
Array<Array<Mat<CFix> > > aamcf(10, UFIX32);
Even a Fix/CFix declaration can take a Fix_Factory as a constructor argument:
This syntax is also legal if Fix is replaced with double
and CFix is replaced with complex<double>
, i.e.
Vec<double> vd(10, UFIX32);
Array<Array<Mat<complex<double> > > > aamcd(10, UFIX32);
double d(UFIX32);
which can be useful in templated code, e.g. when the same code should support both floating- and fixed-point data types.
Definition at line 120 of file fix_factory.h.