Base class for fixed-point data types. More...
#include <itpp/fixed/fix_base.h>
Public Member Functions | |
Fix_Base (int s=0, int w=MAX_WORDLEN, e_mode e=TC, o_mode o=WRAP, q_mode q=TRN, Stat *ptr=0) | |
Default constructor. More... | |
Fix_Base (const Fix_Base &x) | |
Copy constructor. More... | |
virtual | ~Fix_Base () |
Destructor. More... | |
void | set_shift (int s) |
Set shift (without shifting) More... | |
int | get_shift () const |
Get shift. More... | |
int | get_wordlen () const |
Get word length. More... | |
e_mode | get_e_mode () const |
Get sign encoding mode. More... | |
o_mode | get_o_mode () const |
Get overflow mode. More... | |
q_mode | get_q_mode () const |
Get quantization mode. More... | |
output_mode | get_output_mode () const |
Get output mode. More... | |
fixrep | get_max () const |
Get maximum value of data representation. More... | |
fixrep | get_min () const |
Get minimum value of data representation. More... | |
virtual void | print () const |
Print restrictions. More... | |
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. More... | |
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. More... | |
Protected Member Functions | |
void | init () |
Calculate help variables min, max and n_unused_bits. More... | |
fixrep | apply_o_mode (fixrep x) const |
Handle overflows using overflow mode omode and make call to statistics object (if any) More... | |
fixrep | scale_and_apply_modes (double x) const |
Convert from double to fixrep using shift and quantization mode qmode , then call limit() More... | |
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() More... | |
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) More... | |
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) More... | |
Protected Attributes | |
int | shift |
Accumulated bitshift (positive means left-shifted, negative means right-shifted) More... | |
int | wordlen |
Word length. More... | |
e_mode | emode |
Sign encoding mode. More... | |
o_mode | omode |
Overflow mode. More... | |
q_mode | qmode |
Quantization mode. More... | |
Stat * | stat_ptr |
Pointer to statistics object. More... | |
fixrep | min |
Minimum allowed value (help variable to speed up calculations) More... | |
fixrep | max |
Maximum allowed value (help variable to speed up calculations) More... | |
int | n_unused_bits |
Number of unused (MSB) bits (help variable to speed up calculations) More... | |
Base class for fixed-point data types.
See the Detailed Description in the Fixed-point Module module.
Definition at line 981 of file fix_base.h.
|
inlineexplicit |
Default constructor.
Definition at line 985 of file fix_base.h.
|
inline |
Copy constructor.
Definition at line 988 of file fix_base.h.
References itpp::MAX_WORDLEN, itpp::TC, itpp::TRN, and itpp::WRAP.
|
inlinevirtual |
Destructor.
Definition at line 991 of file fix_base.h.
|
inline |
Set shift (without shifting)
Definition at line 994 of file fix_base.h.
Referenced by itpp::operator>>().
|
inlinestatic |
Set output mode to OUTPUT_FIX, OUTPUT_FIX_SHIFT, OUTPUT_FLOAT or OUTPUT_FLOAT_SHIFT. Static member function.
Definition at line 996 of file fix_base.h.
Referenced by itpp::operator<<().
|
static |
Set output mode to "OUTPUT_FIX", "OUTPUT_FIX_SHIFT", "OUTPUT_FLOAT" or "OUTPUT_FLOAT_SHIFT". Static member function.
Definition at line 40 of file fix_base.cpp.
References it_error, itpp::OUTPUT_FIX, itpp::OUTPUT_FIX_SHIFT, itpp::OUTPUT_FLOAT, and itpp::OUTPUT_FLOAT_SHIFT.
|
inline |
Get shift.
Definition at line 1001 of file fix_base.h.
Referenced by itpp::abs(), itpp::assert_fixshift(), itpp::conj(), itpp::imag(), itpp::operator*(), itpp::operator/(), itpp::operator<<(), and itpp::real().
|
inline |
Get word length.
Definition at line 1003 of file fix_base.h.
|
inline |
Get sign encoding mode.
Definition at line 1005 of file fix_base.h.
|
inline |
Get overflow mode.
Definition at line 1007 of file fix_base.h.
|
inline |
Get quantization mode.
Definition at line 1009 of file fix_base.h.
|
inline |
|
inline |
Get maximum value of data representation.
Definition at line 1013 of file fix_base.h.
References itpp::max().
|
inline |
Get minimum value of data representation.
Definition at line 1015 of file fix_base.h.
References itpp::min().
|
virtual |
Print restrictions.
Reimplemented in itpp::CFix, and itpp::Fix.
Definition at line 54 of file fix_base.cpp.
References emode, max, min, n_unused_bits, omode, qmode, shift, stat_ptr, and wordlen.
Referenced by itpp::CFix::print(), and itpp::Fix::print().
|
protected |
Calculate help variables min, max and n_unused_bits.
Definition at line 67 of file fix_base.cpp.
References emode, it_assert_debug, it_error, max, itpp::MAX_WORDLEN, min, n_unused_bits, itpp::TC, itpp::UINT64_POW2, itpp::US, and wordlen.
Handle overflows using overflow mode omode
and make call to statistics object (if any)
Definition at line 88 of file fix_base.cpp.
References it_error, max, min, n_unused_bits, omode, itpp::Stat::sample(), itpp::SAT, stat_ptr, and itpp::WRAP.
Referenced by itpp::CFix::lshift(), itpp::Fix::lshift(), itpp::CFix::operator*=(), itpp::Fix::operator*=(), itpp::CFix::operator+=(), itpp::Fix::operator+=(), itpp::CFix::operator-=(), itpp::Fix::operator-=(), itpp::CFix::operator/=(), itpp::Fix::operator/=(), itpp::CFix::operator<<=(), itpp::Fix::operator<<=(), itpp::CFix::operator=(), itpp::CFixed< w, e, o, q >::operator=(), itpp::Fix::operator=(), itpp::Fixed< w, e, o, q >::operator=(), and scale_and_apply_modes().
|
inlineprotected |
Convert from double
to fixrep
using shift
and quantization mode qmode
, then call limit()
Definition at line 1044 of file fix_base.h.
References scale_and_apply_modes().
Referenced by scale_and_apply_modes(), itpp::CFix::set(), and itpp::Fix::set().
Convert from double
to fixrep
using shift
and quantization mode q
, then call limit()
Definition at line 128 of file fix_base.cpp.
References apply_o_mode(), itpp::DOUBLE_POW2, it_assert_debug, it_error, itpp::RND, itpp::RND_CONV, itpp::RND_CONV_ODD, itpp::RND_INF, itpp::RND_MIN_INF, itpp::RND_ZERO, itpp::round(), shift, itpp::TRN, and itpp::TRN_ZERO.
Right shift n
bits using quantization mode qmode
and make call to statistics object (if any)
Definition at line 1048 of file fix_base.h.
References rshift_and_apply_q_mode().
Referenced by itpp::CFix::operator>>=(), itpp::Fix::operator>>=(), itpp::CFix::rshift(), itpp::Fix::rshift(), and rshift_and_apply_q_mode().
Right shift n
bits using quantization mode q
and make call to statistics object (if any)
Definition at line 182 of file fix_base.cpp.
References it_assert_debug, it_error, itpp::RND, itpp::RND_CONV, itpp::RND_CONV_ODD, itpp::RND_INF, itpp::RND_MIN_INF, itpp::RND_ZERO, itpp::Stat::sample(), stat_ptr, itpp::TRN, and itpp::TRN_ZERO.
|
protected |
Accumulated bitshift (positive means left-shifted, negative means right-shifted)
Definition at line 1021 of file fix_base.h.
Referenced by itpp::CFix::lshift(), itpp::Fix::lshift(), itpp::CFix::operator*=(), itpp::Fix::operator*=(), itpp::CFix::operator+=(), itpp::Fix::operator+=(), itpp::CFix::operator-(), itpp::Fix::operator-(), itpp::CFix::operator-=(), itpp::Fix::operator-=(), itpp::CFix::operator/=(), itpp::Fix::operator/=(), itpp::CFix::operator<<=(), itpp::Fix::operator<<=(), itpp::CFix::operator=(), itpp::CFixed< w, e, o, q >::operator=(), itpp::Fix::operator=(), itpp::Fixed< w, e, o, q >::operator=(), itpp::CFix::operator>>=(), itpp::Fix::operator>>=(), print(), itpp::CFix::rshift(), itpp::Fix::rshift(), scale_and_apply_modes(), itpp::CFix::set(), itpp::Fix::set(), itpp::CFix::unfix(), and itpp::Fix::unfix().
|
protected |
|
protected |
|
protected |
Overflow mode.
Definition at line 1027 of file fix_base.h.
Referenced by apply_o_mode(), and print().
|
protected |
|
protected |
Pointer to statistics object.
Definition at line 1031 of file fix_base.h.
Referenced by apply_o_mode(), print(), and rshift_and_apply_q_mode().
|
protected |
Minimum allowed value (help variable to speed up calculations)
Definition at line 1033 of file fix_base.h.
Referenced by apply_o_mode(), init(), and print().
|
protected |
Maximum allowed value (help variable to speed up calculations)
Definition at line 1035 of file fix_base.h.
Referenced by apply_o_mode(), init(), and print().
|
protected |
Number of unused (MSB) bits (help variable to speed up calculations)
Definition at line 1037 of file fix_base.h.
Referenced by apply_o_mode(), init(), and print().
Generated on Tue Jan 24 2023 00:00:00 for IT++ by Doxygen 1.9.5