IT++ Logo

fix_operators.h

Go to the documentation of this file.
00001 
00031 #ifndef FIX_OPERATORS_H
00032 #define FIX_OPERATORS_H
00033 
00034 #include <itpp/fixed/cfix.h>
00035 #include <itpp/fixed/fix_functions.h>
00036 
00037 
00038 namespace itpp
00039 {
00040 
00043 
00045 // Operators for Fix and Fixed //
00047 
00049 Fix operator+(const Fix &x, const Fix &y);
00051 Fix operator-(const Fix &x, const Fix &y);
00053 Fix operator*(const Fix &x, const Fix &y);
00055 Fix operator/(const Fix &x, const Fix &y);
00056 
00058 Fix operator+(const Fix &x, const int y);
00060 Fix operator-(const Fix &x, const int y);
00062 Fix operator*(const Fix &x, const int y);
00064 Fix operator/(const Fix &x, const int y);
00066 Fix operator+(const int x, const Fix &y);
00068 Fix operator-(const int x, const Fix &y);
00070 Fix operator*(const int x, const Fix &y);
00072 Fix operator/(const int x, const Fix &y);
00073 
00075 inline fixvec operator+(const fixvec &v, const int s) {return v + Fix(s);}
00077 inline fixvec operator+(const int s, const fixvec &v) {return Fix(s) + v;}
00079 inline fixvec operator-(const fixvec &v, const int s) {return v - Fix(s);}
00081 inline fixvec operator-(const int s, const fixvec &v) {return Fix(s) - v;}
00083 inline fixvec operator*(const fixvec &v, const int s) {return v * Fix(s);}
00085 inline fixvec operator*(const int s, const fixvec &v) {return Fix(s) * v;}
00087 inline fixvec operator/(const fixvec &v, const int s) {return v / Fix(s);}
00088 
00090 inline fixmat operator+(const fixmat &v, const int s) {return v + Fix(s);}
00092 inline fixmat operator+(const int s, const fixmat &v) {return Fix(s) + v;}
00094 inline fixmat operator-(const fixmat &v, const int s) {return v - Fix(s);}
00096 inline fixmat operator-(const int s, const fixmat &v) {return Fix(s) - v;}
00098 inline fixmat operator*(const fixmat &v, const int s) {return v * Fix(s);}
00100 inline fixmat operator*(const int s, const fixmat &v) {return Fix(s) * v;}
00102 inline fixmat operator/(const fixmat &v, const int s) {return v / Fix(s);}
00103 
00105 fixvec operator+(const fixvec &a, const ivec &b);
00107 inline fixvec operator+(const ivec &a, const fixvec &b) {return b + a;}
00109 inline fixvec operator-(const fixvec &a, const ivec &b) {return a + (-b);}
00111 inline fixvec operator-(const ivec &a, const fixvec &b) {return (-b) + a;}
00113 Fix operator*(const fixvec &a, const ivec &b);
00115 inline Fix operator*(const ivec &a, const fixvec &b) {return b*a;}
00116 
00118 fixmat operator+(const fixmat &a, const imat &b);
00120 inline fixmat operator+(const imat &a, const fixmat &b) {return b + a;}
00122 inline fixmat operator-(const fixmat &a, const imat &b) {return a + (-b);}
00124 inline fixmat operator-(const imat &a, const fixmat &b) {return (-b) + a;}
00126 fixmat operator*(const fixmat &a, const imat &b);
00128 inline fixmat operator*(const imat &a, const fixmat &b) {return b*a;}
00129 
00131 // Operators for CFix and CFixed //
00133 
00135 CFix operator+(const CFix &x, const CFix &y);
00137 CFix operator-(const CFix &x, const CFix &y);
00139 CFix operator*(const CFix &x, const CFix &y);
00141 CFix operator/(const CFix &x, const CFix &y);
00142 
00144 CFix operator+(const CFix &x, const Fix &y);
00146 CFix operator-(const CFix &x, const Fix &y);
00148 CFix operator*(const CFix &x, const Fix &y);
00150 CFix operator/(const CFix &x, const Fix &y);
00152 CFix operator+(const Fix &x, const CFix &y);
00154 CFix operator-(const Fix &x, const CFix &y);
00156 CFix operator*(const Fix &x, const CFix &y);
00158 CFix operator/(const Fix &x, const CFix &y);
00159 
00161 CFix operator+(const CFix &x, const int y);
00163 CFix operator-(const CFix &x, const int y);
00165 CFix operator*(const CFix &x, const int y);
00167 CFix operator/(const CFix &x, const int y);
00169 CFix operator+(const int x, const CFix &y);
00171 CFix operator-(const int x, const CFix &y);
00173 CFix operator*(const int x, const CFix &y);
00175 CFix operator/(const int x, const CFix &y);
00176 
00178 inline cfixvec operator+(const fixvec &v, const CFix &s) {return to<CFix>(v) + s;}
00180 inline cfixvec operator+(const CFix &s, const fixvec &v) {return s + to<CFix>(v);}
00182 inline cfixvec operator-(const fixvec &v, const CFix &s) {return to<CFix>(v) - s;}
00184 inline cfixvec operator-(const CFix &s, const fixvec &v) {return s - to<CFix>(v);}
00186 inline cfixvec operator*(const fixvec &v, const CFix &s) {return to<CFix>(v) * s;}
00188 inline cfixvec operator*(const CFix &s, const fixvec &v) {return s * to<CFix>(v);}
00190 inline cfixvec operator/(const fixvec &v, const CFix &s) {return to<CFix>(v) / s;}
00191 
00193 inline cfixmat operator+(const fixmat &m, const CFix &s) {return to<CFix>(m) + s;}
00195 inline cfixmat operator+(const CFix &s, const fixmat &m) {return s + to<CFix>(m);}
00197 inline cfixmat operator-(const fixmat &m, const CFix &s) {return to<CFix>(m) - s;}
00199 inline cfixmat operator-(const CFix &s, const fixmat &m) {return s - to<CFix>(m);}
00201 inline cfixmat operator*(const fixmat &m, const CFix &s) {return to<CFix>(m) * s;}
00203 inline cfixmat operator*(const CFix &s, const fixmat &m) {return s * to<CFix>(m);}
00205 inline cfixmat operator/(const fixmat &m, const CFix &s) {return to<CFix>(m) / s;}
00206 
00208 inline cfixvec operator+(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) + s;}
00210 inline cfixvec operator+(const CFix &s, const ivec &v) {return s + to<CFix>(to_vec(v));}
00212 inline cfixvec operator-(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) - s;}
00214 inline cfixvec operator-(const CFix &s, const ivec &v) {return s - to<CFix>(to_vec(v));}
00216 inline cfixvec operator*(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) * s;}
00218 inline cfixvec operator*(const CFix &s, const ivec &v) {return s * to<CFix>(to_vec(v));}
00220 inline cfixvec operator/(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) / s;}
00221 
00223 inline cfixmat operator+(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) + s;}
00225 inline cfixmat operator+(const CFix &s, const imat &m) {return s + to<CFix>(to_mat(m));}
00227 inline cfixmat operator-(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) - s;}
00229 inline cfixmat operator-(const CFix &s, const imat &m) {return s - to<CFix>(to_mat(m));}
00231 inline cfixmat operator*(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) * s;}
00233 inline cfixmat operator*(const CFix &s, const imat &m) {return s * to<CFix>(to_mat(m));}
00235 inline cfixmat operator/(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) / s;}
00236 
00238 inline cfixvec operator+(const cfixvec &v, const Fix &s) {return v + CFix(s);}
00240 inline cfixvec operator+(const Fix &s, const cfixvec &v) {return CFix(s) + v;}
00242 inline cfixvec operator-(const cfixvec &v, const Fix &s) {return v - CFix(s);}
00244 inline cfixvec operator-(const Fix &s, const cfixvec &v) {return CFix(s) - v;}
00246 inline cfixvec operator*(const cfixvec &v, const Fix &s) {return v * CFix(s);}
00248 inline cfixvec operator*(const Fix &s, const cfixvec &v) {return CFix(s) * v;}
00250 inline cfixvec operator/(const cfixvec &v, const Fix &s) {return v / CFix(s);}
00251 
00253 inline cfixmat operator+(const cfixmat &m, const Fix &s) {return m + CFix(s);}
00255 inline cfixmat operator+(const Fix &s, const cfixmat &m) {return CFix(s) + m;}
00257 inline cfixmat operator-(const cfixmat &m, const Fix &s) {return m - CFix(s);}
00259 inline cfixmat operator-(const Fix &s, const cfixmat &m) {return CFix(s) - m;}
00261 inline cfixmat operator*(const cfixmat &m, const Fix &s) {return m * CFix(s);}
00263 inline cfixmat operator*(const Fix &s, const cfixmat &m) {return CFix(s) * m;}
00265 inline cfixmat operator/(const cfixmat &m, const Fix &s) {return m / CFix(s);}
00266 
00268 inline cfixvec operator+(const cfixvec &v, const int s) {return v + CFix(s);}
00270 inline cfixvec operator+(const int s, const cfixvec &v) {return CFix(s) + v;}
00272 inline cfixvec operator-(const cfixvec &v, const int s) {return v - CFix(s);}
00274 inline cfixvec operator-(const int s, const cfixvec &v) {return CFix(s) - v;}
00276 inline cfixvec operator*(const cfixvec &v, const int s) {return v * CFix(s);}
00278 inline cfixvec operator*(const int s, const cfixvec &v) {return CFix(s) * v;}
00280 inline cfixvec operator/(const cfixvec &v, const int s) {return v / CFix(s);}
00281 
00283 inline cfixmat operator+(const cfixmat &m, const int s) {return m + CFix(s);}
00285 inline cfixmat operator+(const int s, const cfixmat &m) {return CFix(s) + m;}
00287 inline cfixmat operator-(const cfixmat &m, const int s) {return m - CFix(s);}
00289 inline cfixmat operator-(const int s, const cfixmat &m) {return CFix(s) - m;}
00291 inline cfixmat operator*(const cfixmat &m, const int s) {return m * CFix(s);}
00293 inline cfixmat operator*(const int s, const cfixmat &m) {return CFix(s) * m;}
00295 inline cfixmat operator/(const cfixmat &m, const int s) {return m / CFix(s);}
00296 
00298 cfixvec operator+(const cfixvec &a, const fixvec &b);
00300 inline cfixvec operator+(const fixvec &a, const cfixvec &b) {return b + a;}
00302 inline cfixvec operator-(const cfixvec &a, const fixvec &b) {return a + (-b);}
00304 inline cfixvec operator-(const fixvec &a, const cfixvec &b) {return (-b) + a;}
00306 CFix operator*(const cfixvec &a, const fixvec &b);
00308 inline CFix operator*(const fixvec &a, const cfixvec &b) {return b*a;}
00309 
00311 cfixmat operator+(const cfixmat &a, const fixmat &b);
00313 inline cfixmat operator+(const fixmat &a, const cfixmat &b) {return b + a;}
00315 inline cfixmat operator-(const cfixmat &a, const fixmat &b) {return a + (-b);}
00317 inline cfixmat operator-(const fixmat &a, const cfixmat &b) {return (-b) + a;}
00319 cfixmat operator*(const cfixmat &a, const fixmat &b);
00321 inline cfixmat operator*(const fixmat &a, const cfixmat &b) {return b*a;}
00322 
00324 cfixvec operator+(const cfixvec &a, const ivec &b);
00326 inline cfixvec operator+(const ivec &a, const cfixvec &b) {return b + a;}
00328 inline cfixvec operator-(const cfixvec &a, const ivec &b) {return a + (-b);}
00330 inline cfixvec operator-(const ivec &a, const cfixvec &b) {return (-b) + a;}
00332 CFix operator*(const cfixvec &a, const ivec &b);
00334 inline CFix operator*(const ivec &a, const cfixvec &b) {return b*a;}
00335 
00337 cfixmat operator+(const cfixmat &a, const imat &b);
00339 inline cfixmat operator+(const imat &a, const cfixmat &b) {return b + a;}
00341 inline cfixmat operator-(const cfixmat &a, const imat &b) {return a + (-b);}
00343 inline cfixmat operator-(const imat &a, const cfixmat &b) {return (-b) + a;}
00345 cfixmat operator*(const cfixmat &a, const imat &b);
00347 inline cfixmat operator*(const imat &a, const cfixmat &b) {return b*a;}
00348 
00350 
00351 } // namespace itpp
00352 
00353 #endif // #ifndef FIX_OPERATORS_H
SourceForge Logo

Generated on Sun Jul 26 08:54:57 2009 for IT++ by Doxygen 1.5.9