IT++ Logo
fix_operators.h
Go to the documentation of this file.
1 
30 #ifndef FIX_OPERATORS_H
31 #define FIX_OPERATORS_H
32 
33 #include <itpp/fixed/cfix.h>
35 #include <itpp/itexports.h>
36 
37 
38 namespace itpp
39 {
40 
43 
45 // Operators for Fix and Fixed //
47 
49 ITPP_EXPORT Fix operator+(const Fix &x, const Fix &y);
51 ITPP_EXPORT Fix operator-(const Fix &x, const Fix &y);
53 ITPP_EXPORT Fix operator*(const Fix &x, const Fix &y);
55 ITPP_EXPORT Fix operator/(const Fix &x, const Fix &y);
56 
58 ITPP_EXPORT Fix operator+(const Fix &x, const int y);
60 ITPP_EXPORT Fix operator-(const Fix &x, const int y);
62 ITPP_EXPORT Fix operator*(const Fix &x, const int y);
64 ITPP_EXPORT Fix operator/(const Fix &x, const int y);
66 ITPP_EXPORT Fix operator+(const int x, const Fix &y);
68 ITPP_EXPORT Fix operator-(const int x, const Fix &y);
70 ITPP_EXPORT Fix operator*(const int x, const Fix &y);
72 ITPP_EXPORT Fix operator/(const int x, const Fix &y);
73 
75 inline fixvec operator+(const fixvec &v, const int s) {return v + Fix(s);}
77 inline fixvec operator+(const int s, const fixvec &v) {return Fix(s) + v;}
79 inline fixvec operator-(const fixvec &v, const int s) {return v - Fix(s);}
81 inline fixvec operator-(const int s, const fixvec &v) {return Fix(s) - v;}
83 inline fixvec operator*(const fixvec &v, const int s) {return v * Fix(s);}
85 inline fixvec operator*(const int s, const fixvec &v) {return Fix(s) * v;}
87 inline fixvec operator/(const fixvec &v, const int s) {return v / Fix(s);}
88 
90 inline fixmat operator+(const fixmat &v, const int s) {return v + Fix(s);}
92 inline fixmat operator+(const int s, const fixmat &v) {return Fix(s) + v;}
94 inline fixmat operator-(const fixmat &v, const int s) {return v - Fix(s);}
96 inline fixmat operator-(const int s, const fixmat &v) {return Fix(s) - v;}
98 inline fixmat operator*(const fixmat &v, const int s) {return v * Fix(s);}
100 inline fixmat operator*(const int s, const fixmat &v) {return Fix(s) * v;}
102 inline fixmat operator/(const fixmat &v, const int s) {return v / Fix(s);}
103 
105 ITPP_EXPORT fixvec operator+(const fixvec &a, const ivec &b);
107 inline fixvec operator+(const ivec &a, const fixvec &b) {return b + a;}
109 inline fixvec operator-(const fixvec &a, const ivec &b) {return a + (-b);}
111 inline fixvec operator-(const ivec &a, const fixvec &b) {return (-b) + a;}
113 ITPP_EXPORT Fix operator*(const fixvec &a, const ivec &b);
115 inline Fix operator*(const ivec &a, const fixvec &b) {return b*a;}
116 
118 ITPP_EXPORT fixmat operator+(const fixmat &a, const imat &b);
120 inline fixmat operator+(const imat &a, const fixmat &b) {return b + a;}
122 inline fixmat operator-(const fixmat &a, const imat &b) {return a + (-b);}
124 inline fixmat operator-(const imat &a, const fixmat &b) {return (-b) + a;}
126 ITPP_EXPORT fixmat operator*(const fixmat &a, const imat &b);
128 inline fixmat operator*(const imat &a, const fixmat &b) {return b*a;}
129 
131 // Operators for CFix and CFixed //
133 
135 ITPP_EXPORT CFix operator+(const CFix &x, const CFix &y);
137 ITPP_EXPORT CFix operator-(const CFix &x, const CFix &y);
139 ITPP_EXPORT CFix operator*(const CFix &x, const CFix &y);
141 ITPP_EXPORT CFix operator/(const CFix &x, const CFix &y);
142 
144 ITPP_EXPORT CFix operator+(const CFix &x, const Fix &y);
146 ITPP_EXPORT CFix operator-(const CFix &x, const Fix &y);
148 ITPP_EXPORT CFix operator*(const CFix &x, const Fix &y);
150 ITPP_EXPORT CFix operator/(const CFix &x, const Fix &y);
152 ITPP_EXPORT CFix operator+(const Fix &x, const CFix &y);
154 ITPP_EXPORT CFix operator-(const Fix &x, const CFix &y);
156 ITPP_EXPORT CFix operator*(const Fix &x, const CFix &y);
158 ITPP_EXPORT CFix operator/(const Fix &x, const CFix &y);
159 
161 ITPP_EXPORT CFix operator+(const CFix &x, const int y);
163 ITPP_EXPORT CFix operator-(const CFix &x, const int y);
165 ITPP_EXPORT CFix operator*(const CFix &x, const int y);
167 ITPP_EXPORT CFix operator/(const CFix &x, const int y);
169 ITPP_EXPORT CFix operator+(const int x, const CFix &y);
171 ITPP_EXPORT CFix operator-(const int x, const CFix &y);
173 ITPP_EXPORT CFix operator*(const int x, const CFix &y);
175 ITPP_EXPORT CFix operator/(const int x, const CFix &y);
176 
178 inline cfixvec operator+(const fixvec &v, const CFix &s) {return to<CFix>(v) + s;}
180 inline cfixvec operator+(const CFix &s, const fixvec &v) {return s + to<CFix>(v);}
182 inline cfixvec operator-(const fixvec &v, const CFix &s) {return to<CFix>(v) - s;}
184 inline cfixvec operator-(const CFix &s, const fixvec &v) {return s - to<CFix>(v);}
186 inline cfixvec operator*(const fixvec &v, const CFix &s) {return to<CFix>(v) * s;}
188 inline cfixvec operator*(const CFix &s, const fixvec &v) {return s * to<CFix>(v);}
190 inline cfixvec operator/(const fixvec &v, const CFix &s) {return to<CFix>(v) / s;}
191 
193 inline cfixmat operator+(const fixmat &m, const CFix &s) {return to<CFix>(m) + s;}
195 inline cfixmat operator+(const CFix &s, const fixmat &m) {return s + to<CFix>(m);}
197 inline cfixmat operator-(const fixmat &m, const CFix &s) {return to<CFix>(m) - s;}
199 inline cfixmat operator-(const CFix &s, const fixmat &m) {return s - to<CFix>(m);}
201 inline cfixmat operator*(const fixmat &m, const CFix &s) {return to<CFix>(m) * s;}
203 inline cfixmat operator*(const CFix &s, const fixmat &m) {return s * to<CFix>(m);}
205 inline cfixmat operator/(const fixmat &m, const CFix &s) {return to<CFix>(m) / s;}
206 
208 inline cfixvec operator+(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) + s;}
210 inline cfixvec operator+(const CFix &s, const ivec &v) {return s + to<CFix>(to_vec(v));}
212 inline cfixvec operator-(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) - s;}
214 inline cfixvec operator-(const CFix &s, const ivec &v) {return s - to<CFix>(to_vec(v));}
216 inline cfixvec operator*(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) * s;}
218 inline cfixvec operator*(const CFix &s, const ivec &v) {return s * to<CFix>(to_vec(v));}
220 inline cfixvec operator/(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) / s;}
221 
223 inline cfixmat operator+(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) + s;}
225 inline cfixmat operator+(const CFix &s, const imat &m) {return s + to<CFix>(to_mat(m));}
227 inline cfixmat operator-(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) - s;}
229 inline cfixmat operator-(const CFix &s, const imat &m) {return s - to<CFix>(to_mat(m));}
231 inline cfixmat operator*(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) * s;}
233 inline cfixmat operator*(const CFix &s, const imat &m) {return s * to<CFix>(to_mat(m));}
235 inline cfixmat operator/(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) / s;}
236 
238 inline cfixvec operator+(const cfixvec &v, const Fix &s) {return v + CFix(s);}
240 inline cfixvec operator+(const Fix &s, const cfixvec &v) {return CFix(s) + v;}
242 inline cfixvec operator-(const cfixvec &v, const Fix &s) {return v - CFix(s);}
244 inline cfixvec operator-(const Fix &s, const cfixvec &v) {return CFix(s) - v;}
246 inline cfixvec operator*(const cfixvec &v, const Fix &s) {return v * CFix(s);}
248 inline cfixvec operator*(const Fix &s, const cfixvec &v) {return CFix(s) * v;}
250 inline cfixvec operator/(const cfixvec &v, const Fix &s) {return v / CFix(s);}
251 
253 inline cfixmat operator+(const cfixmat &m, const Fix &s) {return m + CFix(s);}
255 inline cfixmat operator+(const Fix &s, const cfixmat &m) {return CFix(s) + m;}
257 inline cfixmat operator-(const cfixmat &m, const Fix &s) {return m - CFix(s);}
259 inline cfixmat operator-(const Fix &s, const cfixmat &m) {return CFix(s) - m;}
261 inline cfixmat operator*(const cfixmat &m, const Fix &s) {return m * CFix(s);}
263 inline cfixmat operator*(const Fix &s, const cfixmat &m) {return CFix(s) * m;}
265 inline cfixmat operator/(const cfixmat &m, const Fix &s) {return m / CFix(s);}
266 
268 inline cfixvec operator+(const cfixvec &v, const int s) {return v + CFix(s);}
270 inline cfixvec operator+(const int s, const cfixvec &v) {return CFix(s) + v;}
272 inline cfixvec operator-(const cfixvec &v, const int s) {return v - CFix(s);}
274 inline cfixvec operator-(const int s, const cfixvec &v) {return CFix(s) - v;}
276 inline cfixvec operator*(const cfixvec &v, const int s) {return v * CFix(s);}
278 inline cfixvec operator*(const int s, const cfixvec &v) {return CFix(s) * v;}
280 inline cfixvec operator/(const cfixvec &v, const int s) {return v / CFix(s);}
281 
283 inline cfixmat operator+(const cfixmat &m, const int s) {return m + CFix(s);}
285 inline cfixmat operator+(const int s, const cfixmat &m) {return CFix(s) + m;}
287 inline cfixmat operator-(const cfixmat &m, const int s) {return m - CFix(s);}
289 inline cfixmat operator-(const int s, const cfixmat &m) {return CFix(s) - m;}
291 inline cfixmat operator*(const cfixmat &m, const int s) {return m * CFix(s);}
293 inline cfixmat operator*(const int s, const cfixmat &m) {return CFix(s) * m;}
295 inline cfixmat operator/(const cfixmat &m, const int s) {return m / CFix(s);}
296 
298 ITPP_EXPORT cfixvec operator+(const cfixvec &a, const fixvec &b);
300 inline cfixvec operator+(const fixvec &a, const cfixvec &b) {return b + a;}
302 inline cfixvec operator-(const cfixvec &a, const fixvec &b) {return a + (-b);}
304 inline cfixvec operator-(const fixvec &a, const cfixvec &b) {return (-b) + a;}
306 ITPP_EXPORT CFix operator*(const cfixvec &a, const fixvec &b);
308 inline CFix operator*(const fixvec &a, const cfixvec &b) {return b*a;}
309 
311 ITPP_EXPORT cfixmat operator+(const cfixmat &a, const fixmat &b);
313 inline cfixmat operator+(const fixmat &a, const cfixmat &b) {return b + a;}
315 inline cfixmat operator-(const cfixmat &a, const fixmat &b) {return a + (-b);}
317 inline cfixmat operator-(const fixmat &a, const cfixmat &b) {return (-b) + a;}
319 ITPP_EXPORT cfixmat operator*(const cfixmat &a, const fixmat &b);
321 inline cfixmat operator*(const fixmat &a, const cfixmat &b) {return b*a;}
322 
324 ITPP_EXPORT cfixvec operator+(const cfixvec &a, const ivec &b);
326 inline cfixvec operator+(const ivec &a, const cfixvec &b) {return b + a;}
328 inline cfixvec operator-(const cfixvec &a, const ivec &b) {return a + (-b);}
330 inline cfixvec operator-(const ivec &a, const cfixvec &b) {return (-b) + a;}
332 ITPP_EXPORT CFix operator*(const cfixvec &a, const ivec &b);
334 inline CFix operator*(const ivec &a, const cfixvec &b) {return b*a;}
335 
337 ITPP_EXPORT cfixmat operator+(const cfixmat &a, const imat &b);
339 inline cfixmat operator+(const imat &a, const cfixmat &b) {return b + a;}
341 inline cfixmat operator-(const cfixmat &a, const imat &b) {return a + (-b);}
343 inline cfixmat operator-(const imat &a, const cfixmat &b) {return (-b) + a;}
345 ITPP_EXPORT cfixmat operator*(const cfixmat &a, const imat &b);
347 inline cfixmat operator*(const imat &a, const cfixmat &b) {return b*a;}
348 
350 
351 } // namespace itpp
352 
353 #endif // #ifndef FIX_OPERATORS_H
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:24 for IT++ by Doxygen 1.8.2