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 if (x == 0) { 00084 return 1.0; 00085 } 00086 else { 00087 double pix = itpp::pi * x; 00088 return sin(pix) / pix; 00089 } 00090 } 00091 00093 inline vec sin(const vec &x) { return apply_function<double>(std::sin, x); } 00095 inline mat sin(const mat &x) { return apply_function<double>(std::sin, x); } 00097 inline vec cos(const vec &x) { return apply_function<double>(std::cos, x); } 00099 inline mat cos(const mat &x) { return apply_function<double>(std::cos, x); } 00101 inline vec tan(const vec &x) { return apply_function<double>(std::tan, x); } 00103 inline mat tan(const mat &x) { return apply_function<double>(std::tan, x); } 00105 inline vec asin(const vec &x) { return apply_function<double>(std::asin, x); } 00107 inline mat asin(const mat &x) { return apply_function<double>(std::asin, x); } 00109 inline vec acos(const vec &x) { return apply_function<double>(std::acos, x); } 00111 inline mat acos(const mat &x) { return apply_function<double>(std::acos, x); } 00113 inline vec atan(const vec &x) { return apply_function<double>(std::atan, x); } 00115 inline mat atan(const mat &x) { return apply_function<double>(std::atan, x); } 00117 inline vec sinc(const vec &x) { return apply_function<double>(sinc, x); } 00119 inline mat sinc(const mat &x) { return apply_function<double>(sinc, x); } 00120 00122 00123 00126 00128 inline vec sinh(const vec &x) { return apply_function<double>(std::sinh, x); } 00130 inline mat sinh(const mat &x) { return apply_function<double>(std::sinh, x); } 00132 inline vec cosh(const vec &x) { return apply_function<double>(std::cosh, x); } 00134 inline mat cosh(const mat &x) { return apply_function<double>(std::cosh, x); } 00136 inline vec tanh(const vec &x) { return apply_function<double>(std::tanh, x); } 00138 inline mat tanh(const mat &x) { return apply_function<double>(std::tanh, x); } 00140 inline vec asinh(const vec &x) { return apply_function<double>(::asinh, x); } 00142 inline mat asinh(const mat &x) { return apply_function<double>(::asinh, x); } 00144 inline vec acosh(const vec &x) { return apply_function<double>(::acosh, x); } 00146 inline mat acosh(const mat &x) { return apply_function<double>(::acosh, x); } 00148 inline vec atanh(const vec &x) { return apply_function<double>(::atanh, x); } 00150 inline mat atanh(const mat &x) { return apply_function<double>(::atanh, x); } 00151 00153 00154 } // namespace itpp 00155 00156 #endif // #ifndef TRIG_HYP_H
Generated on Fri Aug 14 15:28:11 2009 for IT++ by Doxygen 1.5.9