IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
36 
37 namespace itpp
38 {
39 
42 
44 // Operators for Fix and Fixed //
46 
48 Fix operator+(const Fix &x, const Fix &y);
50 Fix operator-(const Fix &x, const Fix &y);
52 Fix operator*(const Fix &x, const Fix &y);
54 Fix operator/(const Fix &x, const Fix &y);
55 
57 Fix operator+(const Fix &x, const int y);
59 Fix operator-(const Fix &x, const int y);
61 Fix operator*(const Fix &x, const int y);
63 Fix operator/(const Fix &x, const int y);
65 Fix operator+(const int x, const Fix &y);
67 Fix operator-(const int x, const Fix &y);
69 Fix operator*(const int x, const Fix &y);
71 Fix operator/(const int x, const Fix &y);
72 
74 inline fixvec operator+(const fixvec &v, const int s) {return v + Fix(s);}
76 inline fixvec operator+(const int s, const fixvec &v) {return Fix(s) + v;}
78 inline fixvec operator-(const fixvec &v, const int s) {return v - Fix(s);}
80 inline fixvec operator-(const int s, const fixvec &v) {return Fix(s) - v;}
82 inline fixvec operator*(const fixvec &v, const int s) {return v * Fix(s);}
84 inline fixvec operator*(const int s, const fixvec &v) {return Fix(s) * v;}
86 inline fixvec operator/(const fixvec &v, const int s) {return v / Fix(s);}
87 
89 inline fixmat operator+(const fixmat &v, const int s) {return v + Fix(s);}
91 inline fixmat operator+(const int s, const fixmat &v) {return Fix(s) + v;}
93 inline fixmat operator-(const fixmat &v, const int s) {return v - Fix(s);}
95 inline fixmat operator-(const int s, const fixmat &v) {return Fix(s) - v;}
97 inline fixmat operator*(const fixmat &v, const int s) {return v * Fix(s);}
99 inline fixmat operator*(const int s, const fixmat &v) {return Fix(s) * v;}
101 inline fixmat operator/(const fixmat &v, const int s) {return v / Fix(s);}
102 
104 fixvec operator+(const fixvec &a, const ivec &b);
106 inline fixvec operator+(const ivec &a, const fixvec &b) {return b + a;}
108 inline fixvec operator-(const fixvec &a, const ivec &b) {return a + (-b);}
110 inline fixvec operator-(const ivec &a, const fixvec &b) {return (-b) + a;}
112 Fix operator*(const fixvec &a, const ivec &b);
114 inline Fix operator*(const ivec &a, const fixvec &b) {return b*a;}
115 
117 fixmat operator+(const fixmat &a, const imat &b);
119 inline fixmat operator+(const imat &a, const fixmat &b) {return b + a;}
121 inline fixmat operator-(const fixmat &a, const imat &b) {return a + (-b);}
123 inline fixmat operator-(const imat &a, const fixmat &b) {return (-b) + a;}
125 fixmat operator*(const fixmat &a, const imat &b);
127 inline fixmat operator*(const imat &a, const fixmat &b) {return b*a;}
128 
130 // Operators for CFix and CFixed //
132 
134 CFix operator+(const CFix &x, const CFix &y);
136 CFix operator-(const CFix &x, const CFix &y);
138 CFix operator*(const CFix &x, const CFix &y);
140 CFix operator/(const CFix &x, const CFix &y);
141 
143 CFix operator+(const CFix &x, const Fix &y);
145 CFix operator-(const CFix &x, const Fix &y);
147 CFix operator*(const CFix &x, const Fix &y);
149 CFix operator/(const CFix &x, const Fix &y);
151 CFix operator+(const Fix &x, const CFix &y);
153 CFix operator-(const Fix &x, const CFix &y);
155 CFix operator*(const Fix &x, const CFix &y);
157 CFix operator/(const Fix &x, const CFix &y);
158 
160 CFix operator+(const CFix &x, const int y);
162 CFix operator-(const CFix &x, const int y);
164 CFix operator*(const CFix &x, const int y);
166 CFix operator/(const CFix &x, const int y);
168 CFix operator+(const int x, const CFix &y);
170 CFix operator-(const int x, const CFix &y);
172 CFix operator*(const int x, const CFix &y);
174 CFix operator/(const int x, const CFix &y);
175 
177 inline cfixvec operator+(const fixvec &v, const CFix &s) {return to<CFix>(v) + s;}
179 inline cfixvec operator+(const CFix &s, const fixvec &v) {return s + to<CFix>(v);}
181 inline cfixvec operator-(const fixvec &v, const CFix &s) {return to<CFix>(v) - s;}
183 inline cfixvec operator-(const CFix &s, const fixvec &v) {return s - to<CFix>(v);}
185 inline cfixvec operator*(const fixvec &v, const CFix &s) {return to<CFix>(v) * s;}
187 inline cfixvec operator*(const CFix &s, const fixvec &v) {return s * to<CFix>(v);}
189 inline cfixvec operator/(const fixvec &v, const CFix &s) {return to<CFix>(v) / s;}
190 
192 inline cfixmat operator+(const fixmat &m, const CFix &s) {return to<CFix>(m) + s;}
194 inline cfixmat operator+(const CFix &s, const fixmat &m) {return s + to<CFix>(m);}
196 inline cfixmat operator-(const fixmat &m, const CFix &s) {return to<CFix>(m) - s;}
198 inline cfixmat operator-(const CFix &s, const fixmat &m) {return s - to<CFix>(m);}
200 inline cfixmat operator*(const fixmat &m, const CFix &s) {return to<CFix>(m) * s;}
202 inline cfixmat operator*(const CFix &s, const fixmat &m) {return s * to<CFix>(m);}
204 inline cfixmat operator/(const fixmat &m, const CFix &s) {return to<CFix>(m) / s;}
205 
207 inline cfixvec operator+(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) + s;}
209 inline cfixvec operator+(const CFix &s, const ivec &v) {return s + to<CFix>(to_vec(v));}
211 inline cfixvec operator-(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) - s;}
213 inline cfixvec operator-(const CFix &s, const ivec &v) {return s - to<CFix>(to_vec(v));}
215 inline cfixvec operator*(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) * s;}
217 inline cfixvec operator*(const CFix &s, const ivec &v) {return s * to<CFix>(to_vec(v));}
219 inline cfixvec operator/(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) / s;}
220 
222 inline cfixmat operator+(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) + s;}
224 inline cfixmat operator+(const CFix &s, const imat &m) {return s + to<CFix>(to_mat(m));}
226 inline cfixmat operator-(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) - s;}
228 inline cfixmat operator-(const CFix &s, const imat &m) {return s - to<CFix>(to_mat(m));}
230 inline cfixmat operator*(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) * s;}
232 inline cfixmat operator*(const CFix &s, const imat &m) {return s * to<CFix>(to_mat(m));}
234 inline cfixmat operator/(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) / s;}
235 
237 inline cfixvec operator+(const cfixvec &v, const Fix &s) {return v + CFix(s);}
239 inline cfixvec operator+(const Fix &s, const cfixvec &v) {return CFix(s) + v;}
241 inline cfixvec operator-(const cfixvec &v, const Fix &s) {return v - CFix(s);}
243 inline cfixvec operator-(const Fix &s, const cfixvec &v) {return CFix(s) - v;}
245 inline cfixvec operator*(const cfixvec &v, const Fix &s) {return v * CFix(s);}
247 inline cfixvec operator*(const Fix &s, const cfixvec &v) {return CFix(s) * v;}
249 inline cfixvec operator/(const cfixvec &v, const Fix &s) {return v / CFix(s);}
250 
252 inline cfixmat operator+(const cfixmat &m, const Fix &s) {return m + CFix(s);}
254 inline cfixmat operator+(const Fix &s, const cfixmat &m) {return CFix(s) + m;}
256 inline cfixmat operator-(const cfixmat &m, const Fix &s) {return m - CFix(s);}
258 inline cfixmat operator-(const Fix &s, const cfixmat &m) {return CFix(s) - m;}
260 inline cfixmat operator*(const cfixmat &m, const Fix &s) {return m * CFix(s);}
262 inline cfixmat operator*(const Fix &s, const cfixmat &m) {return CFix(s) * m;}
264 inline cfixmat operator/(const cfixmat &m, const Fix &s) {return m / CFix(s);}
265 
267 inline cfixvec operator+(const cfixvec &v, const int s) {return v + CFix(s);}
269 inline cfixvec operator+(const int s, const cfixvec &v) {return CFix(s) + v;}
271 inline cfixvec operator-(const cfixvec &v, const int s) {return v - CFix(s);}
273 inline cfixvec operator-(const int s, const cfixvec &v) {return CFix(s) - v;}
275 inline cfixvec operator*(const cfixvec &v, const int s) {return v * CFix(s);}
277 inline cfixvec operator*(const int s, const cfixvec &v) {return CFix(s) * v;}
279 inline cfixvec operator/(const cfixvec &v, const int s) {return v / CFix(s);}
280 
282 inline cfixmat operator+(const cfixmat &m, const int s) {return m + CFix(s);}
284 inline cfixmat operator+(const int s, const cfixmat &m) {return CFix(s) + m;}
286 inline cfixmat operator-(const cfixmat &m, const int s) {return m - CFix(s);}
288 inline cfixmat operator-(const int s, const cfixmat &m) {return CFix(s) - m;}
290 inline cfixmat operator*(const cfixmat &m, const int s) {return m * CFix(s);}
292 inline cfixmat operator*(const int s, const cfixmat &m) {return CFix(s) * m;}
294 inline cfixmat operator/(const cfixmat &m, const int s) {return m / CFix(s);}
295 
297 cfixvec operator+(const cfixvec &a, const fixvec &b);
299 inline cfixvec operator+(const fixvec &a, const cfixvec &b) {return b + a;}
301 inline cfixvec operator-(const cfixvec &a, const fixvec &b) {return a + (-b);}
303 inline cfixvec operator-(const fixvec &a, const cfixvec &b) {return (-b) + a;}
305 CFix operator*(const cfixvec &a, const fixvec &b);
307 inline CFix operator*(const fixvec &a, const cfixvec &b) {return b*a;}
308 
310 cfixmat operator+(const cfixmat &a, const fixmat &b);
312 inline cfixmat operator+(const fixmat &a, const cfixmat &b) {return b + a;}
314 inline cfixmat operator-(const cfixmat &a, const fixmat &b) {return a + (-b);}
316 inline cfixmat operator-(const fixmat &a, const cfixmat &b) {return (-b) + a;}
318 cfixmat operator*(const cfixmat &a, const fixmat &b);
320 inline cfixmat operator*(const fixmat &a, const cfixmat &b) {return b*a;}
321 
323 cfixvec operator+(const cfixvec &a, const ivec &b);
325 inline cfixvec operator+(const ivec &a, const cfixvec &b) {return b + a;}
327 inline cfixvec operator-(const cfixvec &a, const ivec &b) {return a + (-b);}
329 inline cfixvec operator-(const ivec &a, const cfixvec &b) {return (-b) + a;}
331 CFix operator*(const cfixvec &a, const ivec &b);
333 inline CFix operator*(const ivec &a, const cfixvec &b) {return b*a;}
334 
336 cfixmat operator+(const cfixmat &a, const imat &b);
338 inline cfixmat operator+(const imat &a, const cfixmat &b) {return b + a;}
340 inline cfixmat operator-(const cfixmat &a, const imat &b) {return a + (-b);}
342 inline cfixmat operator-(const imat &a, const cfixmat &b) {return (-b) + a;}
344 cfixmat operator*(const cfixmat &a, const imat &b);
346 inline cfixmat operator*(const imat &a, const cfixmat &b) {return b*a;}
347 
349 
350 } // namespace itpp
351 
352 #endif // #ifndef FIX_OPERATORS_H
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:13 for IT++ by Doxygen 1.8.1.2