33 #include <itpp/itexports.h>
40 template<
class Num_T>
class Vec;
41 template<
class Num_T>
class Mat;
53 template<
int, e_mode, o_mode, q_mode>
friend class CFixed;
57 :
Fix_Base(s, w, e, o, q, ptr), re(scale_and_apply_modes(r)), im(scale_and_apply_modes(i)) {}
60 :
Fix_Base(s, w, e, o, q, ptr), re(scale_and_apply_modes(std::
real(x))), im(scale_and_apply_modes(std::
imag(x))) {}
63 :
Fix_Base(0, f.wordlen, f.emode, f.omode, f.qmode, f.stat_ptr), re(0), im(0) {}
72 :
Fix_Base(x.shift, w, e, o, q, ptr), re(x.re), im(x.im) {}
81 CFix& operator=(
const std::complex<double> &x);
83 CFix& operator=(
const int x);
89 CFix& operator+=(
const int x);
95 CFix& operator-=(
const int x);
101 CFix& operator*=(
const int x);
105 CFix& operator/=(
const Fix &x);
107 CFix& operator/=(
const int x);
111 CFix& operator<<=(
const int n);
113 CFix& operator>>=(
const int n);
116 void set(
double real,
double imag,
int n);
120 void set(
const std::complex<double> &x,
int n);
122 void set(
const std::complex<double> &x,
int n,
q_mode q);
133 void rshift(
int n,
q_mode q);
136 virtual void print()
const;
142 std::complex<double>
unfix()
const;
144 #ifndef NO_IMPLICIT_FIX_CONVERSION
146 operator std::complex<double>()
const {
147 it_assert_debug(shift >= -63 && shift <= 64,
"CFix::operator complex<double>: Illegal shift!");
148 return std::complex<double>(double(re)*
DOUBLE_POW2[64 - shift],
149 double(im)*DOUBLE_POW2[64 - shift]);
175 ITPP_EXPORT std::ostream &
operator<<(std::ostream &os,
const CFix &x);
191 #endif // #ifndef CFIX_H