IT++ Logo Newcom Logo

bessel.cpp

Go to the documentation of this file.
00001 
00033 #include <itpp/base/bessel.h>
00034 #include <itpp/base/bessel/bessel_internal.h>
00035 #include <cmath>
00036 
00037 
00038 namespace itpp { 
00039 
00040   // Bessel function of order nu
00041   double besselj(int nu, double x) 
00042   { 
00043 #ifdef _MSC_VER
00044     return _jn(nu, x); 
00045 #else
00046     return jn(nu, x); 
00047 #endif
00048   }
00049 
00050   vec besselj(int nu, const vec &x)
00051   {
00052     vec out(x.size());
00053     for (int i=0; i<x.size(); i++)
00054 #ifdef _MSC_VER
00055       out(i) = _jn(nu, x(i));
00056 #else
00057       out(i) = jn(nu, x(i));
00058 #endif
00059 
00060     return out;
00061   }
00062 
00063   // Bessel function of order nu. nu is real.
00064   double besselj(double nu, double x) { return jv(nu, x); }
00065 
00066   vec besselj(double nu, const vec &x)
00067   {
00068     vec out(x.size());
00069     for (int i=0; i<x.size(); i++)
00070       out(i) = jv(nu, x(i));
00071 
00072     return out;
00073   }
00074 
00075   // Bessel function of second kind of order nu
00076   double bessely(int nu, double x) 
00077   { 
00078 #ifdef _MSC_VER
00079     return _yn(nu, x); 
00080 #else
00081     return yn(nu, x); 
00082 #endif
00083   }
00084 
00085   vec bessely(int nu, const vec &x)
00086   {
00087     vec out(x.size());
00088     for (int i=0; i<x.size(); i++)
00089 #ifdef _MSC_VER
00090       out(i) = _yn(nu, x(i));
00091 #else
00092       out(i) = yn(nu, x(i));
00093 #endif
00094 
00095     return out;
00096   }
00097   // Bessel function of second kind of order nu
00098   double bessely(double nu, double x) { return yv(nu, x); }
00099 
00100   vec bessely(double nu, const vec &x)
00101   {
00102     vec out(x.size());
00103     for (int i=0; i<x.size(); i++)
00104       out(i) = yv(nu, x(i));
00105 
00106     return out;
00107   }
00108 
00109   // Modified Bessel function of order nu
00110   double besseli(double nu, double x) { return iv(nu, x); }
00111 
00112   vec besseli(double nu, const vec &x)
00113   {
00114     vec out(x.size());
00115     for (int i=0; i<x.size(); i++)
00116       out(i) = iv(nu, x(i));
00117 
00118     return out;
00119   }
00120 
00121   // Modified Bessel function of second kind of order n
00122   double besselk(int n, double x) { return kn(n, x); }
00123 
00124   vec besselk(int nu, const vec &x)
00125   {
00126     vec out(x.size());
00127     for (int i=0; i<x.size(); i++)
00128       out(i) = kn(nu, x(i));
00129 
00130     return out;
00131   }
00132 
00133 } // namespace itpp
SourceForge Logo

Generated on Wed Mar 21 12:21:31 2007 for IT++ by Doxygen 1.4.7