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 
00042 
00044   // Operators for Fix and Fixed //
00046 
00048   Fix operator+(const Fix &x, const Fix &y);
00050   Fix operator-(const Fix &x, const Fix &y);
00052   Fix operator*(const Fix &x, const Fix &y);
00054   Fix operator/(const Fix &x, const Fix &y);
00055 
00057   Fix operator+(const Fix &x, const int y);
00059   Fix operator-(const Fix &x, const int y);
00061   Fix operator*(const Fix &x, const int y);
00063   Fix operator/(const Fix &x, const int y);
00065   Fix operator+(const int x, const Fix &y);
00067   Fix operator-(const int x, const Fix &y);
00069   Fix operator*(const int x, const Fix &y);
00071   Fix operator/(const int x, const Fix &y);
00072 
00074   inline fixvec operator+(const fixvec &v, const int s) {return v + Fix(s);}
00076   inline fixvec operator+(const int s, const fixvec &v) {return Fix(s) + v;}
00078   inline fixvec operator-(const fixvec &v, const int s) {return v - Fix(s);}
00080   inline fixvec operator-(const int s, const fixvec &v) {return Fix(s) - v;}
00082   inline fixvec operator*(const fixvec &v, const int s) {return v * Fix(s);}
00084   inline fixvec operator*(const int s, const fixvec &v) {return Fix(s) * v;}
00086   inline fixvec operator/(const fixvec &v, const int s) {return v / Fix(s);}
00087 
00089   inline fixmat operator+(const fixmat &v, const int s) {return v + Fix(s);}
00091   inline fixmat operator+(const int s, const fixmat &v) {return Fix(s) + v;}
00093   inline fixmat operator-(const fixmat &v, const int s) {return v - Fix(s);}
00095   inline fixmat operator-(const int s, const fixmat &v) {return Fix(s) - v;}
00097   inline fixmat operator*(const fixmat &v, const int s) {return v * Fix(s);}
00099   inline fixmat operator*(const int s, const fixmat &v) {return Fix(s) * v;}
00101   inline fixmat operator/(const fixmat &v, const int s) {return v / Fix(s);}
00102 
00104   fixvec operator+(const fixvec &a, const ivec &b);
00106   inline fixvec operator+(const ivec &a, const fixvec &b) {return b+a;}
00108   inline fixvec operator-(const fixvec &a, const ivec &b) {return a+(-b);}
00110   inline fixvec operator-(const ivec &a, const fixvec &b) {return (-b)+a;}
00112   Fix operator*(const fixvec &a, const ivec &b);
00114   inline Fix operator*(const ivec &a, const fixvec &b) {return b*a;}
00115 
00117   fixmat operator+(const fixmat &a, const imat &b);
00119   inline fixmat operator+(const imat &a, const fixmat &b) {return b+a;}
00121   inline fixmat operator-(const fixmat &a, const imat &b) {return a+(-b);}
00123   inline fixmat operator-(const imat &a, const fixmat &b) {return (-b)+a;}
00125   fixmat operator*(const fixmat &a, const imat &b);
00127   inline fixmat operator*(const imat &a, const fixmat &b) {return b*a;}
00128 
00130   // Operators for CFix and CFixed //
00132 
00134   CFix operator+(const CFix &x, const CFix &y);
00136   CFix operator-(const CFix &x, const CFix &y);
00138   CFix operator*(const CFix &x, const CFix &y);
00140   CFix operator/(const CFix &x, const CFix &y);
00141 
00143   CFix operator+(const CFix &x, const Fix &y);
00145   CFix operator-(const CFix &x, const Fix &y);
00147   CFix operator*(const CFix &x, const Fix &y);
00149   CFix operator/(const CFix &x, const Fix &y);
00151   CFix operator+(const Fix &x, const CFix &y);
00153   CFix operator-(const Fix &x, const CFix &y);
00155   CFix operator*(const Fix &x, const CFix &y);
00157   CFix operator/(const Fix &x, const CFix &y);
00158 
00160   CFix operator+(const CFix &x, const int y);
00162   CFix operator-(const CFix &x, const int y);
00164   CFix operator*(const CFix &x, const int y);
00166   CFix operator/(const CFix &x, const int y);
00168   CFix operator+(const int x, const CFix &y);
00170   CFix operator-(const int x, const CFix &y);
00172   CFix operator*(const int x, const CFix &y);
00174   CFix operator/(const int x, const CFix &y);
00175 
00177   inline cfixvec operator+(const fixvec &v, const CFix &s) {return to<CFix>(v) + s;}
00179   inline cfixvec operator+(const CFix &s, const fixvec &v) {return s + to<CFix>(v);}
00181   inline cfixvec operator-(const fixvec &v, const CFix &s) {return to<CFix>(v) - s;}
00183   inline cfixvec operator-(const CFix &s, const fixvec &v) {return s - to<CFix>(v);}
00185   inline cfixvec operator*(const fixvec &v, const CFix &s) {return to<CFix>(v) * s;}
00187   inline cfixvec operator*(const CFix &s, const fixvec &v) {return s * to<CFix>(v);}
00189   inline cfixvec operator/(const fixvec &v, const CFix &s) {return to<CFix>(v) / s;}
00190 
00192   inline cfixmat operator+(const fixmat &m, const CFix &s) {return to<CFix>(m) + s;}
00194   inline cfixmat operator+(const CFix &s, const fixmat &m) {return s + to<CFix>(m);}
00196   inline cfixmat operator-(const fixmat &m, const CFix &s) {return to<CFix>(m) - s;}
00198   inline cfixmat operator-(const CFix &s, const fixmat &m) {return s - to<CFix>(m);}
00200   inline cfixmat operator*(const fixmat &m, const CFix &s) {return to<CFix>(m) * s;}
00202   inline cfixmat operator*(const CFix &s, const fixmat &m) {return s * to<CFix>(m);}
00204   inline cfixmat operator/(const fixmat &m, const CFix &s) {return to<CFix>(m) / s;}
00205 
00207   inline cfixvec operator+(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) + s;}
00209   inline cfixvec operator+(const CFix &s, const ivec &v) {return s + to<CFix>(to_vec(v));}
00211   inline cfixvec operator-(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) - s;}
00213   inline cfixvec operator-(const CFix &s, const ivec &v) {return s - to<CFix>(to_vec(v));}
00215   inline cfixvec operator*(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) * s;}
00217   inline cfixvec operator*(const CFix &s, const ivec &v) {return s * to<CFix>(to_vec(v));}
00219   inline cfixvec operator/(const ivec &v, const CFix &s) {return to<CFix>(to_vec(v)) / s;}
00220 
00222   inline cfixmat operator+(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) + s;}
00224   inline cfixmat operator+(const CFix &s, const imat &m) {return s + to<CFix>(to_mat(m));}
00226   inline cfixmat operator-(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) - s;}
00228   inline cfixmat operator-(const CFix &s, const imat &m) {return s - to<CFix>(to_mat(m));}
00230   inline cfixmat operator*(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) * s;}
00232   inline cfixmat operator*(const CFix &s, const imat &m) {return s * to<CFix>(to_mat(m));}
00234   inline cfixmat operator/(const imat &m, const CFix &s) {return to<CFix>(to_mat(m)) / s;}
00235 
00237   inline cfixvec operator+(const cfixvec &v, const Fix &s) {return v + CFix(s);}
00239   inline cfixvec operator+(const Fix &s, const cfixvec &v) {return CFix(s) + v;}
00241   inline cfixvec operator-(const cfixvec &v, const Fix &s) {return v - CFix(s);}
00243   inline cfixvec operator-(const Fix &s, const cfixvec &v) {return CFix(s) - v;}
00245   inline cfixvec operator*(const cfixvec &v, const Fix &s) {return v * CFix(s);}
00247   inline cfixvec operator*(const Fix &s, const cfixvec &v) {return CFix(s) * v;}
00249   inline cfixvec operator/(const cfixvec &v, const Fix &s) {return v / CFix(s);}
00250 
00252   inline cfixmat operator+(const cfixmat &m, const Fix &s) {return m + CFix(s);}
00254   inline cfixmat operator+(const Fix &s, const cfixmat &m) {return CFix(s) + m;}
00256   inline cfixmat operator-(const cfixmat &m, const Fix &s) {return m - CFix(s);}
00258   inline cfixmat operator-(const Fix &s, const cfixmat &m) {return CFix(s) - m;}
00260   inline cfixmat operator*(const cfixmat &m, const Fix &s) {return m * CFix(s);}
00262   inline cfixmat operator*(const Fix &s, const cfixmat &m) {return CFix(s) * m;}
00264   inline cfixmat operator/(const cfixmat &m, const Fix &s) {return m / CFix(s);}
00265 
00267   inline cfixvec operator+(const cfixvec &v, const int s) {return v + CFix(s);}
00269   inline cfixvec operator+(const int s, const cfixvec &v) {return CFix(s) + v;}
00271   inline cfixvec operator-(const cfixvec &v, const int s) {return v - CFix(s);}
00273   inline cfixvec operator-(const int s, const cfixvec &v) {return CFix(s) - v;}
00275   inline cfixvec operator*(const cfixvec &v, const int s) {return v * CFix(s);}
00277   inline cfixvec operator*(const int s, const cfixvec &v) {return CFix(s) * v;}
00279   inline cfixvec operator/(const cfixvec &v, const int s) {return v / CFix(s);}
00280 
00282   inline cfixmat operator+(const cfixmat &m, const int s) {return m + CFix(s);}
00284   inline cfixmat operator+(const int s, const cfixmat &m) {return CFix(s) + m;}
00286   inline cfixmat operator-(const cfixmat &m, const int s) {return m - CFix(s);}
00288   inline cfixmat operator-(const int s, const cfixmat &m) {return CFix(s) - m;}
00290   inline cfixmat operator*(const cfixmat &m, const int s) {return m * CFix(s);}
00292   inline cfixmat operator*(const int s, const cfixmat &m) {return CFix(s) * m;}
00294   inline cfixmat operator/(const cfixmat &m, const int s) {return m / CFix(s);}
00295 
00297   cfixvec operator+(const cfixvec &a, const fixvec &b);
00299   inline cfixvec operator+(const fixvec &a, const cfixvec &b) {return b+a;}
00301   inline cfixvec operator-(const cfixvec &a, const fixvec &b) {return a+(-b);}
00303   inline cfixvec operator-(const fixvec &a, const cfixvec &b) {return (-b)+a;}
00305   CFix operator*(const cfixvec &a, const fixvec &b);
00307   inline CFix operator*(const fixvec &a, const cfixvec &b) {return b*a;}
00308 
00310   cfixmat operator+(const cfixmat &a, const fixmat &b);
00312   inline cfixmat operator+(const fixmat &a, const cfixmat &b) {return b+a;}
00314   inline cfixmat operator-(const cfixmat &a, const fixmat &b) {return a+(-b);}
00316   inline cfixmat operator-(const fixmat &a, const cfixmat &b) {return (-b)+a;}
00318   cfixmat operator*(const cfixmat &a, const fixmat &b);
00320   inline cfixmat operator*(const fixmat &a, const cfixmat &b) {return b*a;}
00321 
00323   cfixvec operator+(const cfixvec &a, const ivec &b);
00325   inline cfixvec operator+(const ivec &a, const cfixvec &b) {return b+a;}
00327   inline cfixvec operator-(const cfixvec &a, const ivec &b) {return a+(-b);}
00329   inline cfixvec operator-(const ivec &a, const cfixvec &b) {return (-b)+a;}
00331   CFix operator*(const cfixvec &a, const ivec &b);
00333   inline CFix operator*(const ivec &a, const cfixvec &b) {return b*a;}
00334 
00336   cfixmat operator+(const cfixmat &a, const imat &b);
00338   inline cfixmat operator+(const imat &a, const cfixmat &b) {return b+a;}
00340   inline cfixmat operator-(const cfixmat &a, const imat &b) {return a+(-b);}
00342   inline cfixmat operator-(const imat &a, const cfixmat &b) {return (-b)+a;}
00344   cfixmat operator*(const cfixmat &a, const imat &b);
00346   inline cfixmat operator*(const imat &a, const cfixmat &b) {return b*a;}
00347 
00349 
00350 } // namespace itpp
00351 
00352 #endif // #ifndef FIX_OPERATORS_H
SourceForge Logo

Generated on Sat Apr 19 10:43:55 2008 for IT++ by Doxygen 1.5.5