IT++ Logo Newcom Logo

elmatfunc.h

Go to the documentation of this file.
00001 
00033 #ifndef ELMATFUNC_H
00034 #define ELMATFUNC_H
00035 
00036 #include <itpp/base/help_functions.h>
00037 #include <itpp/base/converters.h>
00038 
00039 
00040 namespace itpp {
00041   // ACTION: This should be split into several files. And documented per group
00048 inline itpp::vec gamma(const itpp::vec &x) {return itpp::vec_function((double(*)(double)) gamma,x);}
00049 
00054 inline itpp::mat gamma(const itpp::mat &x) {return itpp::mat_function((double(*)(double)) gamma,x);}
00055 
00058 
00060   inline vec exp(const vec &x) {return vec_function((double(*)(double)) std::exp,x);}
00062   inline cvec exp(const cvec &x) {return cvec_function((std::complex<double>(*)(const std::complex<double> &)) std::exp,x);}
00063 
00065   inline mat exp(const mat &x) {return mat_function((double(*)(double)) std::exp,x);}
00067   inline cmat exp(const cmat &x) {return cmat_function((std::complex<double>(*)(const std::complex<double> &)) std::exp,x);}
00069   inline vec pow(const double x, const vec &y)
00070     {return double_vec_function((double(*)(double,double)) std::pow,x,y);}
00072   inline mat pow(const double x, const mat &y)
00073     {return double_mat_function((double(*)(double,double)) std::pow,x,y);}
00075   inline vec pow(const vec &x, const double y)
00076     {return vec_double_function((double(*)(double,double)) std::pow,x,y);}
00078   inline mat pow(const mat &x, const double y)
00079     {return mat_double_function((double(*)(double,double)) std::pow,x,y);}
00081   inline vec pow2(const vec &x)
00082     {return vec_function((double(*)(double)) pow2,x);}
00084   inline mat pow2(const mat &x)
00085     {return mat_function((double(*)(double)) pow2,x);}
00087   inline vec pow10(const vec &x)
00088     {return vec_function((double(*)(double)) pow10,x);}
00090   inline mat pow10(const mat &x)
00091     {return mat_function((double(*)(double)) pow10,x);}
00092 
00094   inline vec log(const vec &x) {return vec_function((double(*)(double)) std::log,x);}
00096   inline mat log(const mat &x) {return mat_function((double(*)(double)) std::log,x);}
00098   inline cvec log(const cvec &x) {return cvec_function((std::complex<double>(*)(const std::complex<double> &)) std::log,x);}
00100   inline cmat log(const cmat &x) {return cmat_function((std::complex<double>(*)(const std::complex<double> &)) std::log,x);}
00101 
00102 
00104   inline vec log2(const vec &x) {return vec_function((double(*)(double)) itpp::log2,x);}
00106   inline mat log2(const mat &x) {return mat_function((double(*)(double)) itpp::log2,x);}
00107 
00109   inline vec log10(const vec &x) {return vec_function((double(*)(double)) std::log10,x);}
00111   inline mat log10(const mat &x) {return mat_function((double(*)(double)) std::log10,x);}
00113   inline vec logb(const short b,const vec &x) {return double_vec_function(itpp::logb,b,x);}
00115   inline mat logb(const short b,const mat &x) {return double_mat_function(itpp::logb,b,x);}
00116 
00118   inline vec dB(const vec &x) {return vec_function(dB,x);}
00120   inline mat dB(const mat &x) {return mat_function(dB,x);}
00122   inline vec inv_dB(const vec &x) {return vec_function(inv_dB,x);}
00124   inline mat inv_dB(const mat &x) {return mat_function(inv_dB,x);}
00126 
00127 
00130 
00132   inline vec erf(const vec &x) {return vec_function((double(*)(double)) ::erf,x);}
00134   inline mat erf(const mat &x) {return mat_function((double(*)(double)) ::erf,x);}
00136   inline cvec erf(const cvec &x) {return cvec_function((std::complex<double>(*)(const std::complex<double> &)) erf,x);}
00138   inline cmat erf(const cmat &x) {return cmat_function((std::complex<double>(*)(const std::complex<double> &)) erf,x);}
00140   inline vec erfinv(const vec &x) {return vec_function(erfinv,x);}
00142   inline mat erfinv(const mat &x) {return mat_function(erfinv,x);}
00144   inline vec erfc(const vec &x) {return vec_function((double(*)(double)) ::erfc,x);}
00146   inline mat erfc(const mat &x) {return mat_function((double(*)(double)) ::erfc,x);}
00148   inline vec Qfunc(const vec &x) {return vec_function(Qfunc,x);}
00150   inline mat Qfunc(const mat &x) {return mat_function(Qfunc,x);}
00152 
00153 
00156 
00158   inline vec sin(const vec &x) {return vec_function((double(*)(double)) std::sin,x);}
00160   inline mat sin(const mat &x) {return mat_function((double(*)(double)) std::sin,x);}
00162   inline vec cos(const vec &x) {return vec_function((double(*)(double)) std::cos,x);}
00164   inline mat cos(const mat &x) {return mat_function((double(*)(double)) std::cos,x);}
00166   inline vec tan(const vec &x) {return vec_function((double(*)(double)) std::tan,x);}
00168   inline mat tan(const mat &x) {return mat_function((double(*)(double)) std::tan,x);}
00170   inline vec asin(const vec &x) {return vec_function((double(*)(double)) std::asin,x);}
00172   inline mat asin(const mat &x) {return mat_function((double(*)(double)) std::asin,x);}
00174   inline vec acos(const vec &x) {return vec_function((double(*)(double)) std::acos,x);}
00176   inline mat acos(const mat &x) {return mat_function((double(*)(double)) std::acos,x);}
00178   inline vec atan(const vec &x) {return vec_function((double(*)(double)) std::atan,x);}
00180   inline mat atan(const mat &x) {return mat_function((double(*)(double)) std::atan,x);}
00182   inline vec sinc(const vec &x) {return vec_function((double(*)(double)) sinc,x);}
00184   inline mat sinc(const mat &x) {return mat_function((double(*)(double)) sinc,x);}
00186 
00187 
00190 
00192   inline vec sinh(const vec &x) {return vec_function((double(*)(double)) std::sinh,x);}
00194   inline mat sinh(const mat &x) {return mat_function((double(*)(double)) std::sinh,x);}
00196   inline vec cosh(const vec &x) {return vec_function((double(*)(double)) std::cosh,x);}
00198   inline mat cosh(const mat &x) {return mat_function((double(*)(double)) std::cosh,x);}
00200   inline vec tanh(const vec &x) {return vec_function((double(*)(double)) std::tanh,x);}
00202   inline mat tanh(const mat &x) {return mat_function((double(*)(double)) std::tanh,x);}
00204   inline vec asinh(const vec &x) {return vec_function((double(*)(double)) ::asinh,x);}
00206   inline mat asinh(const mat &x) {return mat_function((double(*)(double)) ::asinh,x);}
00208   inline vec acosh(const vec &x) {return vec_function((double(*)(double)) ::acosh,x);}
00210   inline mat acosh(const mat &x) {return mat_function((double(*)(double)) ::acosh,x);}
00212   inline vec atanh(const vec &x) {return vec_function((double(*)(double)) ::atanh,x);}
00214   inline mat atanh(const mat &x) {return mat_function((double(*)(double)) ::atanh,x);}
00216 
00217 
00220 
00222   inline vec ceil(const vec &x) {return vec_function((double(*)(double)) std::ceil,x);}
00224   inline mat ceil(const mat &x) {return mat_function((double(*)(double)) std::ceil,x);}
00226   inline vec floor(const vec &x) {return vec_function((double(*)(double)) std::floor,x);}
00228   inline mat floor(const mat &x) {return mat_function((double(*)(double)) std::floor,x);}
00229 
00231   inline vec round(const vec &x) {return vec_function((double(*)(double)) round,x);}
00233   inline mat round(const mat &x) {return mat_function((double(*)(double)) round,x);}
00234 
00236   inline ivec round_i(const vec &x) {return to_ivec(round(x));}
00238   inline imat round_i(const mat &x) {return to_imat(round(x));}
00239 
00240 
00242   inline vec abs(const vec &x) {return vec_function((double(*)(double)) std::fabs,x);}
00244   inline mat abs(const mat &x) {return mat_function((double(*)(double)) std::fabs,x);}
00246   ivec abs(const ivec &x);
00248   imat abs(const imat &x);
00250   inline vec sqr(const vec &x) {return vec_function(sqr,x);}
00252   inline mat sqr(const mat &x) {return mat_function(sqr,x);}
00254   vec sqr(const cvec &x);
00256   mat sqr(const cmat &x);
00258   inline vec sign(const vec &x) {return vec_function(sign,x);}
00260   inline mat sign(const mat &x) {return mat_function(sign,x);}
00261 
00263   inline vec sqrt(const vec &x) {return vec_function((double(*)(double)) std::sqrt,x);}
00265   inline mat sqrt(const mat &x) {return mat_function((double(*)(double)) std::sqrt,x);}
00266 
00267   // ACTION: mod()
00268 
00270   inline vec rem(const vec &x,const double &y) {return vec_double_function(rem,x,y);}
00272   inline vec rem(const double &x,const vec &y) {return double_vec_function(rem,x,y);}
00274   inline mat rem(const mat &x,const double &y) {return mat_double_function(rem,x,y);}
00276   inline mat rem(const double &x,const mat &y) {return double_mat_function(rem,x,y);}
00277 
00279   vec abs(const cvec &x);
00281   mat abs(const cmat &x);
00283   vec real(const cvec &x);
00285   mat real(const cmat &x);
00287   vec imag(const cvec &x);
00289   mat imag(const cmat &x);
00291   vec arg(const cvec &x);
00293   mat arg(const cmat &x);
00295   inline vec angle(const cvec &x) { return arg(x); }
00297   inline mat angle(const cmat &x) { return arg(x); }
00299   cvec conj(const cvec &x);
00301   cmat conj(const cmat &x);
00302 
00304   bool all(const Vec<bin> &testvec);
00306   bool any(const Vec<bin> &testvec);
00307 
00309   inline vec round_to_zero(const vec &x, double threshold = 1e-14) {
00310     return vec_double_function((double(*)(double,double)) round_to_zero,x,threshold);
00311   }
00313   inline mat round_to_zero(const mat &x, double threshold = 1e-14) {
00314     return mat_double_function((double(*)(double,double)) round_to_zero,x,threshold);
00315   }
00317   cvec round_to_zero(const cvec &x, double threshold = 1e-14);
00318 
00320   cmat round_to_zero(const cmat &x, double threshold = 1e-14);
00321 
00323 
00324 } // namespace itpp
00325 
00326 #endif // #ifndef ELMATFUNC_H
00327 
00328 
00329 
00330 
SourceForge Logo

Generated on Fri Jun 8 01:07:07 2007 for IT++ by Doxygen 1.5.2