IT++ Logo
cfixed.h
Go to the documentation of this file.
1
29#ifndef CFIXED_H
30#define CFIXED_H
31
32#include <itpp/fixed/cfix.h>
33#include <itpp/itexports.h>
34
35
36namespace itpp
37{
38
49template < int w, e_mode e = TC, o_mode o = WRAP, q_mode q = TRN >
50class CFixed : public CFix
51{
52public:
54 CFixed(double r = 0.0, double i = 0.0, int s = 0, Stat *ptr = 0)
55 : CFix(r, i, s, w, e, o, q, ptr) {}
57 CFixed(std::complex<double> x, double, int s = 0, Stat *ptr = 0)
58 : CFix(x, 0.0, s, w, e, o, q, ptr) {}
60 explicit CFixed(Stat *ptr)
61 : CFix(0.0, 0.0, 0, w, e, o, q, ptr) {}
63 CFixed(const Fix &r, const Fix &i = 0.0, Stat *ptr = 0)
64 : CFix(r, i, w, e, o, q, ptr) {}
66 CFixed(const CFix &x, double, Stat *ptr = 0)
67 : CFix(x, 0.0, w, e, o, q, ptr) {}
69 virtual ~CFixed() {}
70
72 CFixed& operator=(const CFix &x) {
73 shift = x.shift;
74 re = apply_o_mode(x.re);
75 im = apply_o_mode(x.im);
76 return *this;
77 }
79 CFixed& operator=(const Fix &x) {
80 shift = x.shift;
81 re = apply_o_mode(x.re);
82 im = 0;
83 return *this;
84 }
86 CFixed& operator=(const std::complex<double> &x) {
87 shift = 0;
90 return *this;
91 }
93 CFixed& operator=(int x) {
94 shift = 0;
95 re = apply_o_mode(x);
96 im = 0;
97 return *this;
98 }
99protected:
100};
101
171
239
240// ----------------------------------------------------------------------
241// Instantiations
242// ----------------------------------------------------------------------
244
246
247} // namespace itpp
248
249#endif // #ifndef CFIXED_H
Definitions of a complex fixed-point data type CFix.
General array class.
Definition array.h:105
Complex fixed-point data type.
Definition cfix.h:52
fixrep im
Imaginary data part.
Definition cfix.h:162
fixrep re
Real data part.
Definition cfix.h:161
Templated complex fixed-point data type.
Definition cfixed.h:51
CFixed(std::complex< double > x, double, int s=0, Stat *ptr=0)
Constructor.
Definition cfixed.h:57
virtual ~CFixed()
Destructor.
Definition cfixed.h:69
CFixed(const CFix &x, double, Stat *ptr=0)
Constructor.
Definition cfixed.h:66
CFixed(const Fix &r, const Fix &i=0.0, Stat *ptr=0)
Constructor.
Definition cfixed.h:63
CFixed(Stat *ptr)
Constructor.
Definition cfixed.h:60
CFixed & operator=(const CFix &x)
Assignment from CFix.
Definition cfixed.h:72
CFixed & operator=(const Fix &x)
Assignment from Fix.
Definition cfixed.h:79
CFixed(double r=0.0, double i=0.0, int s=0, Stat *ptr=0)
Default constructor.
Definition cfixed.h:54
CFixed & operator=(const std::complex< double > &x)
Assignment from complex<double>. Fractional part is truncated.
Definition cfixed.h:86
CFixed & operator=(int x)
Assignment from int.
Definition cfixed.h:93
fixrep apply_o_mode(fixrep x) const
Handle overflows using overflow mode omode and make call to statistics object (if any)
Definition fix_base.cpp:88
int shift
Accumulated bitshift (positive means left-shifted, negative means right-shifted)
Definition fix_base.h:1021
Fixed-point data type.
Definition fix.h:52
fixrep re
Data representation.
Definition fix.h:137
A class for sampling a signal and calculating statistics.
Definition misc_stat.h:49
int64_t fixrep
Representation for fixed-point data types.
Definition fix_base.h:884
vec imag(const cvec &data)
Imaginary part of complex values.
vec real(const cvec &data)
Real part of complex values.
itpp namespace
Definition itmex.h:37
CFixed< 1, TC, WRAP > cfixed1
Typedefs for CFixed (cfixed1, cfixed2, ..., cfixed64)
Definition cfixed.h:105
SourceForge Logo

Generated on Mon Jun 10 2024 11:49:23 for IT++ by Doxygen 1.9.8