File indexing completed on 2025-01-18 09:54:34
0001
0002
0003 #include "CLHEP/GenericFunctions/Variable.hh"
0004 #include "CLHEP/GenericFunctions/Power.hh"
0005 #include <gsl/gsl_sf_legendre.h>
0006 #include <cmath>
0007 #include <signal.h>
0008 #include <assert.h>
0009
0010
0011 namespace Genfun {
0012
0013 FUNCTION_OBJECT_IMP(AssociatedLegendre)
0014
0015
0016 inline double dfactorial (int n) {
0017 if (n<=1) return 1.0;
0018 else return n*dfactorial(n-2);
0019 }
0020
0021 inline
0022 AssociatedLegendre::AssociatedLegendre(unsigned int l, unsigned int m):
0023 AbsFunction(),
0024 _l(l),
0025 _m(m)
0026 {
0027 assert(m<=l);
0028 }
0029
0030 inline
0031 AssociatedLegendre::~AssociatedLegendre() {
0032 }
0033
0034 inline
0035 AssociatedLegendre::AssociatedLegendre(const AssociatedLegendre & right):
0036 AbsFunction(),
0037 _l(right._l),
0038 _m(right._m)
0039 {
0040 }
0041
0042 inline
0043 unsigned int AssociatedLegendre::l() const {
0044 return _l;
0045 }
0046
0047 inline
0048 unsigned int AssociatedLegendre::m() const {
0049 return _m;
0050 }
0051
0052
0053 inline
0054 double AssociatedLegendre::operator() (double x) const {
0055 gsl_sf_result result;
0056 int status = gsl_sf_legendre_Plm_e (_l, _m, x, &result);
0057
0058 if (status!=0) {
0059 std::cerr << "Warning, GSL function gsl_sf_bessel_Yn_impl"
0060 << " return code" << status << std::endl;
0061 raise(SIGFPE);
0062 }
0063 return result.val;
0064 }
0065
0066 }