00001 00030 #ifndef TRIG_HYP_H 00031 #define TRIG_HYP_H 00032 00033 #ifndef _MSC_VER 00034 # include <itpp/config.h> 00035 #else 00036 # include <itpp/config_msvc.h> 00037 #endif 00038 00039 #include <itpp/base/help_functions.h> 00040 00041 00044 00045 #ifndef HAVE_ASINH 00047 inline double asinh(double x) 00048 { 00049 return ((x >= 0) ? log(x + sqrt(x * x + 1)) : -log(-x + sqrt(x * x + 1))); 00050 } 00051 #endif 00052 00053 #ifndef HAVE_ACOSH 00055 inline double acosh(double x) 00056 { 00057 it_error_if(x < 1, "acosh(): Argument must be greater then 1."); 00058 return log(x + sqrt(x * x - 1.0)); 00059 } 00060 #endif 00061 00062 #ifndef HAVE_ATANH 00064 inline double atanh(double x) 00065 { 00066 it_error_if(fabs(x) >= 1, "atanh(): Argument out of range."); 00067 return 0.5 * log((x + 1) / (x - 1)); 00068 } 00069 #endif 00070 00072 00073 00074 namespace itpp 00075 { 00076 00079 00081 inline double sinc(double x) 00082 { 00083 return ((x == 0) ? 1.0 : sin(itpp::pi * x) / itpp::pi / x); 00084 } 00085 00087 inline vec sin(const vec &x) { return apply_function<double>(std::sin, x); } 00089 inline mat sin(const mat &x) { return apply_function<double>(std::sin, x); } 00091 inline vec cos(const vec &x) { return apply_function<double>(std::cos, x); } 00093 inline mat cos(const mat &x) { return apply_function<double>(std::cos, x); } 00095 inline vec tan(const vec &x) { return apply_function<double>(std::tan, x); } 00097 inline mat tan(const mat &x) { return apply_function<double>(std::tan, x); } 00099 inline vec asin(const vec &x) { return apply_function<double>(std::asin, x); } 00101 inline mat asin(const mat &x) { return apply_function<double>(std::asin, x); } 00103 inline vec acos(const vec &x) { return apply_function<double>(std::acos, x); } 00105 inline mat acos(const mat &x) { return apply_function<double>(std::acos, x); } 00107 inline vec atan(const vec &x) { return apply_function<double>(std::atan, x); } 00109 inline mat atan(const mat &x) { return apply_function<double>(std::atan, x); } 00111 inline vec sinc(const vec &x) { return apply_function<double>(sinc, x); } 00113 inline mat sinc(const mat &x) { return apply_function<double>(sinc, x); } 00114 00116 00117 00120 00122 inline vec sinh(const vec &x) { return apply_function<double>(std::sinh, x); } 00124 inline mat sinh(const mat &x) { return apply_function<double>(std::sinh, x); } 00126 inline vec cosh(const vec &x) { return apply_function<double>(std::cosh, x); } 00128 inline mat cosh(const mat &x) { return apply_function<double>(std::cosh, x); } 00130 inline vec tanh(const vec &x) { return apply_function<double>(std::tanh, x); } 00132 inline mat tanh(const mat &x) { return apply_function<double>(std::tanh, x); } 00134 inline vec asinh(const vec &x) { return apply_function<double>(::asinh, x); } 00136 inline mat asinh(const mat &x) { return apply_function<double>(::asinh, x); } 00138 inline vec acosh(const vec &x) { return apply_function<double>(::acosh, x); } 00140 inline mat acosh(const mat &x) { return apply_function<double>(::acosh, x); } 00142 inline vec atanh(const vec &x) { return apply_function<double>(::atanh, x); } 00144 inline mat atanh(const mat &x) { return apply_function<double>(::atanh, x); } 00145 00147 00148 } // namespace itpp 00149 00150 #endif // #ifndef TRIG_HYP_H
Generated on Fri Jul 25 12:42:58 2008 for IT++ by Doxygen 1.5.4