CLHEP 2.4.7.1
C++ Class Library for High Energy Physics
AssociatedLegendre.icc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id:
5#include <gsl/gsl_sf_legendre.h>
6#include <cmath>
7#include <signal.h>
8#include <assert.h>
9
10
11namespace Genfun {
12
14
15// This is the product n (n-2) (n-4)...
16inline double dfactorial (int n) {
17 if (n<=1) return 1.0;
18 else return n*dfactorial(n-2);
19}
20//
21inline
22AssociatedLegendre::AssociatedLegendre(unsigned int l, unsigned int m):
24 _l(l),
25 _m(m)
26{
27 assert(m<=l);
28}
29
30inline
33
34inline
37_l(right._l),
38_m(right._m)
39{
40}
41
42inline
43unsigned int AssociatedLegendre::l() const {
44 return _l;
45}
46
47inline
48unsigned int AssociatedLegendre::m() const {
49 return _m;
50}
51
52
53inline
54double AssociatedLegendre::operator() (double x) const {
55 gsl_sf_result result;
56 int status = gsl_sf_legendre_Plm_e (_l, _m, x, &result);
57
58 if (status!=0) {
59 std::cerr << "Warning, GSL function gsl_sf_bessel_Yn_impl"
60 << " return code" << status << std::endl;
61 raise(SIGFPE);
62 }
63 return result.val;
64}
65
66} // end namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
AssociatedLegendre(unsigned int l, unsigned int m)
virtual double operator()(double argument) const override
Definition Abs.hh:14
double dfactorial(int n)